Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word VBA: deployment

Status
Not open for further replies.

sharon3874

Programmer
Oct 27, 2006
24
US
I am new in VBA. I am sorry in advance if my question doesn't make sense.

I have a document with a button triggering a macro. I am just wondering how I deliver it to my users. I don't want my users to see the macro code, which I have already handled it with password protection.

My question is how I can prevent them from even switching to the design mode? Right now I can switch to the design mode by clicking View --> Toolbars --> Control Toolbox. I believe the user can do the same thing, right? So I am wondering normally how do you deploy a word doc with macro? Is there a special deployment process, or should I just write another macro(or any other way) to disable the "Control Toolbox" choice? If I need to disable the choice, how?

I will be really appreciated if you can advice. Thanks.
 
Thank you for your reply.

Actually, I want them to see the document, and also modify the document.

I have customized the shortcut menu(right-click menu) on hyperlinks(add and delete menu items during runtime). I am asking the question because if I switch to the design mode, and exit the design mode, the menu doesn't work properly. If I don't switch to the design mode ever, it works fine. Thus I am trying to prevent them from switching to the design mode.
 
The real bottom line is: if you have clever users, you can't really prevent them from doing anything. You CAN disable the toggle by rewriting the Word command for it. Obviously you would want the rewrite to check to see if it is YOU who are trying to toggle. This checks the login name, if it is NOT you it displays a message; it is IS you it performs the toggle.
Code:
Sub ToggleFormsDesign()
  If Environ("username") <> "[i]your login name[/i]" Then
     Msgbox "Sorry, but Design Mode is not available."
  Else
     ActiveDocument.ToggleFormsDesign
  End If
End Sub
But again, you can password protect all you want, rewrite stuff all you want...but Word is never going to be made secure against someone who really knows what they are doing.

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top