Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

disabling/enabling a control on a menu

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fred Kruger - 08 Nov 2006 17:31 GMT
Can anyone give me a easy way of setting the protect/unprotect document
control in the tools menu to prevent it being used with specific documents i
create. I know i can use the enable true/false but how can i specify this
specific control without having to scroll through all the controls. I know it
has a specific control ID can I use this to select it if so how??

cheers

fred
Doug Robbins - Word MVP - 09 Nov 2006 06:08 GMT
Create a macro in the template from which the documents are created with the
name of ToolsProtectUnprotectDocument containing the following code:

Msgbox "The facility to change the protection status of this document has
been disabled."

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Can anyone give me a easy way of setting the protect/unprotect document
> control in the tools menu to prevent it being used with specific documents
[quoted text clipped - 7 lines]
>
> fred
Fred Kruger - 09 Nov 2006 06:38 GMT
Doug

What is the could please you have only sent the message box wording.

Fred

> Create a macro in the template from which the documents are created with the
> name of ToolsProtectUnprotectDocument containing the following code:
[quoted text clipped - 13 lines]
> >
> > fred
Jezebel - 09 Nov 2006 06:43 GMT
Read Doug's post again.

> Doug
>
[quoted text clipped - 23 lines]
>> >
>> > fred
Doug Robbins - Word MVP - 09 Nov 2006 06:45 GMT
Sub ToolsProtectUnprotectDocument()

Msgbox "The facility to change the protection status of this document has
been disabled."

End Sub

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Doug
>
[quoted text clipped - 23 lines]
>> >
>> > fred
Fred Kruger - 09 Nov 2006 08:00 GMT
Doug

perhaps its me thats no explained myself right.....

what is the vba code to select a specific id of a control and then set the
enable value to false rather than looking for the name of the control.

i.e the protect document button has an id no of 336 how do i use this to
always select that specific button and set the.enable function to false.
Because if the document is unprotected the name tag is protect document if
the document is protected it is unprotect document but the id no never
changes.

Or is it me that just cant see what you have sent.

Thanks for bearing with me on this.

Fred

> Sub ToolsProtectUnprotectDocument()
>
[quoted text clipped - 30 lines]
> >> >
> >> > fred
Doug Robbins - Word MVP - 09 Nov 2006 08:18 GMT
I think it is you.  If you put the macro that I gave you into the template,
the user will not be able to change the protection status of the document;
if it is not protected, they will not be able to protect it; if it is
protected, they will not be able to remove the protection.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Doug
>
[quoted text clipped - 53 lines]
>> >> >
>> >> > fred
Norman Goetz - 09 Nov 2006 09:09 GMT
Is that your Realname ?? Afraid of

>Can anyone give me a easy way of setting the protect/unprotect document
>control in the tools menu to prevent it being used with specific documents i
>create. I know i can use the enable true/false but how can i specify this
>specific control without having to scroll through all the controls. I know it
>has a specific control ID can I use this to select it if so how??

Public Sub Protectable(ByVal bEnable As Boolean)
   Dim cmdBARS As Office.CommandBars
   Dim cmdCTR As Office.CommandBarControl
   Dim myMenu As CommandBarPopup
   Set cmdBARS = Application.CommandBars
'Perhaps you have to check for the right Item
   Set myMenu = cmdBARS.ActiveMenuBar.Controls.Item(6)
'This is what you meant ?
   Set cmdCTR = myMenu.CommandBar.FindControl(msoControlButton, 336)
   cmdCTR.Enabled = bEnable
End Sub

HtH

Norman Goetz
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.