Hi all of you willing to help.
I have created a addin which on open should create some different commandbars. The worksheet menu bar gets added without any problem but the "Cell" ones do not. I don't get any errors and if I try to run the code after the workbook has been opened, the code works fine. I have added the code below and appreciate any answers.
The workbook_open sub looks like this
Private Sub Workbook_Open()
InstallAddIn 'Checks if there is a new addin avialable and installs this. Works just fine!
AddMenus 'Adds a Worksheet Menu Bar. Works just fine
RClick 'Do not work
RChartClick 'Do not work
End Sub
The RClick sub looks like this
Sub RClick()
Application.CommandBars("Cell").Reset
With Application.CommandBars("Cell").Controls
With .Add(Type:=msoControlButton)
.Caption = "Calculate Sheet"
.FaceId = 263
.OnAction = "CalculateSheet"
End With
With .Add(Type:=msoControlButton)
.Caption = "Calculate Range"
.FaceId = 263
.OnAction = "CalculateRange"
End With
With .Add(Type:=msoControlButton)
.Caption = "Calculate Row"
.FaceId = 263
.OnAction = "CalculateRow"
End With
With .Add(Type:=msoControlButton)
.Caption = "Insert range to PPT"
.FaceId = 267
.OnAction = "insert_range"
End With
End With
End Sub
Thank you in advance!!!!
Erik
I have created a addin which on open should create some different commandbars. The worksheet menu bar gets added without any problem but the "Cell" ones do not. I don't get any errors and if I try to run the code after the workbook has been opened, the code works fine. I have added the code below and appreciate any answers.
The workbook_open sub looks like this
Private Sub Workbook_Open()
InstallAddIn 'Checks if there is a new addin avialable and installs this. Works just fine!
AddMenus 'Adds a Worksheet Menu Bar. Works just fine
RClick 'Do not work
RChartClick 'Do not work
End Sub
The RClick sub looks like this
Sub RClick()
Application.CommandBars("Cell").Reset
With Application.CommandBars("Cell").Controls
With .Add(Type:=msoControlButton)
.Caption = "Calculate Sheet"
.FaceId = 263
.OnAction = "CalculateSheet"
End With
With .Add(Type:=msoControlButton)
.Caption = "Calculate Range"
.FaceId = 263
.OnAction = "CalculateRange"
End With
With .Add(Type:=msoControlButton)
.Caption = "Calculate Row"
.FaceId = 263
.OnAction = "CalculateRow"
End With
With .Add(Type:=msoControlButton)
.Caption = "Insert range to PPT"
.FaceId = 267
.OnAction = "insert_range"
End With
End With
End Sub
Thank you in advance!!!!
Erik