The workbook will have to be open. What you need to do is put some code into an Auto_Open macro. this macro will automatically run when the workbook is opened.
Sample:
'Find ID number of Standard Toolbar "Print" button
For i = 1 To 25
If Left(CommandBars("Standard").Controls(i).Caption, 5) = "Print" Then
PrintButton = i
Exit For
End If
Next i
' Disable menu & toolbar functions
CommandBars("Worksheet menu bar").Controls("File").Controls("Save").Enabled = False
CommandBars("Worksheet menu bar").Controls("File").Controls("Page Setup...").Enabled = False
CommandBars("Worksheet menu bar").Controls("File").Controls("Print Area").Enabled = False
CommandBars("Worksheet menu bar").Controls("File").Controls("Print...").Enabled = False
CommandBars("Worksheet menu bar").Controls("File").Controls("Print Preview").Enabled = False
CommandBars("Standard").Controls("Save").Enabled = False
CommandBars("Standard").Controls(PrintButton).Enabled = False
CommandBars("Standard").Controls("Print Preview").Enabled = False
HTH
Keith Hoar
Keith
The above works on a specific workbook, but the macros for which I have toolbar buttons are generic and could work on ANY workbook/worksheet.
Is there any way to disable the buttons when NO workbook is active and to enable them whenever ANY workbook is opened?
Keith,
How about creating a custom toolbar in VBA?