Excel Toolbar

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to force a customized toolbar for one specific file only. For example, when I open rep.xls, I want a customized toolbar to open with it but I want my regular to open with all the other file. In addition, is there a way to avoid any one opening rep.xls to change this? Thank you for your help on this.
 
You have to create and attach the toolbar to the specific file.
(In Excel: View, Toolbars, Customize, Toolbars tab, Attach button, select
the toolbar, click Copy)

Then go into the Visual Basic Editor. Locate the VBAProject(rep.xls) in the
Project Explorer.
Expand the Microsoft Excel Objects and locate ThisWorkbook, double click on
it to see the code window on the right hand side.
Copy and paste the following code into the ThisWorkbook code module.
Note: Replace each occurance of "Purchasing" with the name of your toolbar;
leave the quotation marks in place)

Private Sub Workbook_Open()
Toolbars("Purchasing").Visible = True
End Sub

Private Sub Workbook_Activate()
On Error Resume Next
Toolbars("Purchasing").Visible = True
On Error GoTo 0
End Sub

Private Sub Workbook_Deactivate()
On Error Resume Next
Toolbars("Purchasing").Visible = False
On Error GoTo 0
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Toolbars("Purchasing").Delete
On Error GoTo 0
End Sub


Roya said:
Is there any way to force a customized toolbar for one specific file only.
For example, when I open rep.xls, I want a customized toolbar to open with
it but I want my regular to open with all the other file. In addition, is
there a way to avoid any one opening rep.xls to change this? Thank you for
your help on this.
 
Back
Top