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.

Word 2007 Quick Access Toolbar

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Col - 21 Nov 2006 05:45 GMT
Hi all,

I added two buttons to the QAT to run specific macros.
I need to be able to disable one or both of them depending on the loaded
document.
I could do it with Office 2K3 and command bars but the QAT is a different
animal.

'****************2K3 code to set the enabled property of a button
Function CommandBarEnable(boolIN As Boolean, strBUTNLBL As String) As
Boolean
On Error GoTo Err_CommandBarEnable

   Dim fFound As Boolean
   Dim mCommandBar As CommandBar

   Dim intI As Integer

   fFound = False

   For Each mCommandBar In CommandBars
       For intI = 1 To mCommandBar.Controls.Count
           If mCommandBar.Controls(intI).Caption = strBUTNLBL Then
               fFound = True
               mCommandBar.Controls(intI).Enabled = boolIN
               Exit For
           End If
       Next
       If fFound Then
           Exit For
       End If
   Next
   CommandBarEnable = fFound
Exit_CommandBarEnable:
   Exit Function

Err_CommandBarEnable:
   If Err.Number = 13 Then
       Resume Next
   Else
       MsgBox Err.Number & " " & Err.Description, vbOKOnly + vbExclamation,
"ERROR DETECTED"
       Resume Exit_CommandBarEnable
   End If

End Function
'************************************************
How is this done for the buttons on the Quick Access Toolbar?

Regards
Col
Patrick Schmid [MVP] - 21 Nov 2006 05:51 GMT
How did you add them to the QAT?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

> Hi all,
>
[quoted text clipped - 47 lines]
> Regards
> Col
Col - 21 Nov 2006 21:30 GMT
Just customised the QAT and selected the macros.

> How did you add them to the QAT?
>
[quoted text clipped - 63 lines]
>> Regards
>> Col
Patrick Schmid [MVP] - 21 Nov 2006 22:35 GMT
I can only think of one way to do this...
Write RibbonX for your code that adds the two buttons somewhere on the
Ribbon. Then you can have users add it from there to their QAT. And you
can control the enabled state via RibbonX callbacks.

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

> Just customised the QAT and selected the macros.
>
[quoted text clipped - 65 lines]
> >> Regards
> >> Col
Col - 21 Nov 2006 23:21 GMT
Thanks Patrick,

Looks like I have some studying to do.

Regards
Col

>I can only think of one way to do this...
> Write RibbonX for your code that adds the two buttons somewhere on the
[quoted text clipped - 85 lines]
>> >> Regards
>> >> Col
Patrick Schmid [MVP] - 21 Nov 2006 23:31 GMT
Start with my blog ;)

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

> Thanks Patrick,
>
[quoted text clipped - 92 lines]
> >> >> Regards
> >> >> Col
 
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.