How to dim custom toolbar buttons

J

JAH

Hi,

In word 2003, is there a way to 'dim' or gray-out custom macro toolbar
buttons when no document is open, to mimic the behaviour of built-in
command buttons such as 'save', 'paste' etc? I tried duplicating one
of these built-in buttons, but I could not re-assign my own macros to
it. I simply want to make some of my custom macros unavailable when no
documents are open - at the moment, they check for the presence of an
open document and flag an error or open a blank document, but I
thought there should be a neater way.

Thanks,
John.
 
H

Helmut Weber

Hi John,

a disabled button is greyed out.

Sub Testyyy1()
Dim oCmd As CommandBar
Dim oBtn As CommandBarButton
Set oCmd = ActiveDocument.CommandBars("Test01")
With oCmd
oCmd.Controls(2).Enabled = False
' oCmd.Controls(2).Enabled = True
End With
End Sub

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

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