View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default add a print key only

Hi mikegospo

You can use something like this or use the CTRL-P shortcut with your other code to print


Sub MakeToolBar()
Dim bar As CommandBar
On Error Resume Next
Application.CommandBars("MyToolBar").Delete
On Error GoTo 0
For Each bar In Application.CommandBars
bar.Enabled = False
Next
With Application.CommandBars.Add(Name:="myToolBar", Position:=msoBarTop, MenuBar:=False)
.Protection = msoBarNoCustomize
' Prevent users from accessing the Add or Remove Buttons menu

' this will add a default Excel button
.Controls.Add Type:=msoControlButton, ID:=4
.Visible = True
End With
End Sub


Sub DeleteToolBar()
Dim bar As CommandBar
On Error Resume Next
Application.CommandBars("MyToolBar").Delete
On Error GoTo 0
For Each bar In Application.CommandBars
bar.Enabled = True
Next
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"mikegospo" wrote in message ...

I asked a question earlier about restoring my command menu. I got it to
work. I am using this program. I know want to make it just leave a
print icon of some type. Here is the code I am using

Private Sub Workbook_Activate()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next
End Sub

Private Sub Workbook_Deactivate()
Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = True
Next
End Sub


I guess I need one in between to add the print menu.
Mike


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements