Command Button - does not work on

D

danka

Hello:

I created a command button control and on click event. It works ok on my
machine.
I want to distribute this document to other users. When I try to open and
click on the command button on other machine it opens code instead running.
I must be missing something - how do you distribute documents containing
active controls?

Private Sub CommandButton11_Click()
Options.SendMailAttach = True
ActiveDocument.SendMail
End Sub

Please help. Thanks

Danka
 
C

Cindy M -WordMVP-

Hi Danka,
I created a command button control and on click event. It works ok on my
machine.
I want to distribute this document to other users. When I try to open and
click on the command button on other machine it opens code instead running.
I must be missing something - how do you distribute documents containing
active controls?

Private Sub CommandButton11_Click()
Options.SendMailAttach = True
ActiveDocument.SendMail
End Sub
What you're doing isn't quite clear...

1. In what kind of project are you creating the control and the click event?
Are you working in the Word VBA editor? In VB6? In a Visual Studio IDE? Is this
a VSTO project?

2. If this is in a Word VBA project, in what kind of module did you place this
procedure? Did you set up WithEvents anywhere?

3. What kind of button is this? A toolbar button? An button from the Controls
Toolbox? Something else?

4. Can you provide more information about "it opens the code instead of
running"? Is there an error message? Are any of the lines in the code
highlighted?

5. Which version of Word is this?



Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top