I think this is the correct forum for this because it is happening when trying to open a Word document.
I downloaded a template from Office For Mere Mortals but I have had this happen with other documents too. I have never seen this error before I got this new computer. I am not sure what I am supposed to do when this happens. I have been hitting “End” and then “Enable Editing” and then saving the document. It opens and woks fine until I copy it to another folder and I get this message again. Why am I getting this message and how do I make sure I don’t get it anymore even if I copy it to another folder? Please see attachment.
Thanks
Visual Basic Editor Error
-
- PlatinumLounger
- Posts: 3811
- Joined: 24 Oct 2010, 23:39
- Location: Canton, Ohio USA
Visual Basic Editor Error
You do not have the required permissions to view the files attached to this post.
Regards,
hlewton
hlewton
-
- 5StarLounger
- Posts: 625
- Joined: 10 Jan 2016, 15:56
- Location: Madison, Wisconsin
Re: Visual Basic Editor Error
The error is triggered when code is being run that requires an activedocument and there is no activedocument.
I know that I put error trapping for that into some of my Add-Ins to tell the user to open a document first.
My BarCode AddIn has such code. You are welcome to take a look at it.
http://addbalance.com/word/download.htm#BarCodeAddIn
My code produces the following error message:
I know that I put error trapping for that into some of my Add-Ins to tell the user to open a document first.
My BarCode AddIn has such code. You are welcome to take a look at it.
http://addbalance.com/word/download.htm#BarCodeAddIn
My code produces the following error message:
You do not have the required permissions to view the files attached to this post.
Attorney Charles Kenyon
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
-
- PlatinumLounger
- Posts: 3811
- Joined: 24 Oct 2010, 23:39
- Location: Canton, Ohio USA
Re: Visual Basic Editor Error
I got to thinking and thought to attachment in this post may help. It appeared after I hit "Debug." Still I am not sure why or what I should be doing.
You do not have the required permissions to view the files attached to this post.
Regards,
hlewton
hlewton
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Visual Basic Editor Error
As you can see in the screenshot in the first post, the document is in protected view, so you can't manipulate it. After clicking Enable Editing you should be able to manipulate it.
You can simply avoid the error as follows:
You can simply avoid the error as follows:
Code: Select all
Sub AutoOpen()
On Error GoTo ExitHere
If ActiveDocument.Bookmarks.Exists("OpenAt") Then
ActiveDocument.Bookmarks("OpenAt").Select
End If
ExitHere:
End Sub
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 625
- Joined: 10 Jan 2016, 15:56
- Location: Madison, Wisconsin
Re: Visual Basic Editor Error
I'm not sure why an AutoOpen macro would be running when there is no ActiveDocument.
I still recommend looking at the error trapping in my Add-In.
It may be that you need to insert a delay in your procedure before the call to ActiveDocument.
Otherwise, try Hans' version of your macro.
I still recommend looking at the error trapping in my Add-In.
It may be that you need to insert a delay in your procedure before the call to ActiveDocument.
Otherwise, try Hans' version of your macro.
Last edited by Charles Kenyon on 29 Jun 2020, 20:17, edited 1 time in total.
Attorney Charles Kenyon
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Visual Basic Editor Error
Thanks for the correction, Charles. I also added () after AutoOpen.
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 3811
- Joined: 24 Oct 2010, 23:39
- Location: Canton, Ohio USA
Re: Visual Basic Editor Error
Thanks. So I would copy and paste that in place of what is there now, correct?
Regards,
hlewton
hlewton
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- PlatinumLounger
- Posts: 3811
- Joined: 24 Oct 2010, 23:39
- Location: Canton, Ohio USA
Re: Visual Basic Editor Error
Regards,
hlewton
hlewton
-
- PlatinumLounger
- Posts: 3811
- Joined: 24 Oct 2010, 23:39
- Location: Canton, Ohio USA
Re: Visual Basic Editor Error
Hans, the correction that I was going to copy and paste is gone. Not sure if yours has been edited to reflect the correction. Do I just copy he one in your post now?
Regards,
hlewton
hlewton
-
- 5StarLounger
- Posts: 625
- Joined: 10 Jan 2016, 15:56
- Location: Madison, Wisconsin
Re: Visual Basic Editor Error
I'm not Hans, but, yes. He made a couple of corrections.
Attorney Charles Kenyon
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
-
- PlatinumLounger
- Posts: 3811
- Joined: 24 Oct 2010, 23:39
- Location: Canton, Ohio USA
Re: Visual Basic Editor Error
Thank you.Charles Kenyon wrote: ↑29 Jun 2020, 23:52I'm not Hans, but, yes. He made a couple of corrections.
Regards,
hlewton
hlewton