Hello,
I created a macro and a tool bar to run this macro.
What I want to do is to add this tool bar to all the workbooks in excel.
So whenever some one opens any excel workbook he sees this tool bar.
And if he clicks on the tool bar button then the macro should run from the excel workbook where it is stored.
This is working in my PC where I have developed this macro but if I do it on someone else's PC it doesn't work. The tool bar gets displayed only if I open the worksheet which has this macro.
Below is the code I've written for the tool bar.
Public Const ToolBarName As String = "HIOKI Macro"
'===========================================
Sub Autpen()
Call CreateMenubar
End Sub
'===========================================
Sub Auto_Close()
Call RemoveMenubar
End Sub
'===========================================
Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(ToolBarName).Delete
On Error GoTo 0
End Sub
'===========================================
Sub CreateMenubar()
Dim iCtr As Long
Dim MacNames As Variant
Dim CapNamess As Variant
Dim TipText As Variant
Call RemoveMenubar
MacNames = Array("HIOKI")
CapNamess = Array("HIOKI")
TipText = Array("Import data, draw graphs for HIOKI")
With Application.CommandBars.Add
.name = ToolBarName
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating
For iCtr = LBound(MacNames) To UBound(MacNames)
With .Controls.Add(Type:=msoControlButton)
.OnAction = "'" & ThisWorkbook.name & "'!" & MacNames(iCtr)
.Caption = CapNamess(iCtr)
.Style = msoButtonIconAndCaption
.FaceId = 71 + iCtr
.TooltipText = TipText(iCtr)
End With
Next iCtr
End With
End Sub
Sub HIOKI()
Call mainHOIKI
End Sub
Would appreciate the help in this regard.
Regards
Wasim
I created a macro and a tool bar to run this macro.
What I want to do is to add this tool bar to all the workbooks in excel.
So whenever some one opens any excel workbook he sees this tool bar.
And if he clicks on the tool bar button then the macro should run from the excel workbook where it is stored.
This is working in my PC where I have developed this macro but if I do it on someone else's PC it doesn't work. The tool bar gets displayed only if I open the worksheet which has this macro.
Below is the code I've written for the tool bar.
Public Const ToolBarName As String = "HIOKI Macro"
'===========================================
Sub Autpen()
Call CreateMenubar
End Sub
'===========================================
Sub Auto_Close()
Call RemoveMenubar
End Sub
'===========================================
Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(ToolBarName).Delete
On Error GoTo 0
End Sub
'===========================================
Sub CreateMenubar()
Dim iCtr As Long
Dim MacNames As Variant
Dim CapNamess As Variant
Dim TipText As Variant
Call RemoveMenubar
MacNames = Array("HIOKI")
CapNamess = Array("HIOKI")
TipText = Array("Import data, draw graphs for HIOKI")
With Application.CommandBars.Add
.name = ToolBarName
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating
For iCtr = LBound(MacNames) To UBound(MacNames)
With .Controls.Add(Type:=msoControlButton)
.OnAction = "'" & ThisWorkbook.name & "'!" & MacNames(iCtr)
.Caption = CapNamess(iCtr)
.Style = msoButtonIconAndCaption
.FaceId = 71 + iCtr
.TooltipText = TipText(iCtr)
End With
Next iCtr
End With
End Sub
Sub HIOKI()
Call mainHOIKI
End Sub
Would appreciate the help in this regard.
Regards
Wasim