steven_sanders
asked on
EnvelopeVisible Method using VBA in Word 2002
One question. None of the VB gurus at the office have been able to answer it.
The following simple macro works perfectly when run from the play macros dialogue box in Word 2002:
Sub Visible()
ActiveWindow.EnvelopeVisib le = Not ActiveWindow.EnvelopeVisib le
End Sub
However, when linked to a button using the following script:
Private Sub CommandButton1_Click()
Call Visible
End Sub
The same code which worked perfectly before now results in the following error message:
"Run-time error '4641': Method 'EnvelopeVisisble' of object 'Window' failed"
How do I fix this problem so I can launch the visible () macro above from a button?
The following simple macro works perfectly when run from the play macros dialogue box in Word 2002:
Sub Visible()
ActiveWindow.EnvelopeVisib
End Sub
However, when linked to a button using the following script:
Private Sub CommandButton1_Click()
Call Visible
End Sub
The same code which worked perfectly before now results in the following error message:
"Run-time error '4641': Method 'EnvelopeVisisble' of object 'Window' failed"
How do I fix this problem so I can launch the visible () macro above from a button?
ASKER
I am aware that the property has no effect if the document is not an email message. What intrigues me is that if you run the simple Visible () macro above from the Word Macro dialogue box or from an assigned keyboard shortcut. Whether or not the document is an email message, it successfully opens the email header in Word 2002.
Yet, when you assign this same macro to a button in that word document and run it, the process fails and results in an error.
Can you explain this effect. If you can, I already know how I can utilize this technique to disarm the annoying Outlook permissions requests (e.g. the "Yes" problem) that often occur when I attempt to automate Outlook from other microsoft applications. Of course, if you know of an easier way to disable these Outlook permissions requests such that users I disseminate this application to will not have to first install third-party software: that would be great as well.
Thanks for your efforts thus far. They are duly appreciated.
Yet, when you assign this same macro to a button in that word document and run it, the process fails and results in an error.
Can you explain this effect. If you can, I already know how I can utilize this technique to disarm the annoying Outlook permissions requests (e.g. the "Yes" problem) that often occur when I attempt to automate Outlook from other microsoft applications. Of course, if you know of an easier way to disable these Outlook permissions requests such that users I disseminate this application to will not have to first install third-party software: that would be great as well.
Thanks for your efforts thus far. They are duly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Application.Window("email document").Activate
where "email document" is the file name of the email document.
Regards,
Rob.