New Filename For xlsm creates open error

richlocus
Lounger
Posts: 41
Joined: 03 Oct 2015, 00:30

New Filename For xlsm creates open error

Post by richlocus »

Good Morning:
When I open a working Excel VBA application after I change the filename, it comes up in protected view.
In my application, I have code in the "workbook open" event that fails in protected view because of a change of filename.

To fix the issue, I have the user close the application and re-open it, which seems to solve the issue. However, it's not a good look when they give it to another employee and they complain there is a bug.

Please see the attached images labeled 1, 2 and 3 in that order.

Is there a workaround? I have to do certain functions when the workbook is first opened, such as setting globals and also activating the primary worksheet.

Suggestions?

Thanks,
Rich Locus
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 72233
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: New Filename For xlsm creates open error

Post by HansV »

If you right-click the workbook in File Explorer after renaming it and select Properties from the context menu, is there an Unblock check box near the bottom of the dialog? If so, tick it and click OK, then see if it makes a difference.
Regards,
Hans

richlocus
Lounger
Posts: 41
Joined: 03 Oct 2015, 00:30

Re: New Filename For xlsm creates open error

Post by richlocus »

The suggested solution above works. Thank you.
Rich Locus