ufdistribution.blogg.se

Command button excel not working
Command button excel not working













command button excel not working command button excel not working

If FileToOpen = "" Or LCase(FileToOpen) = "false" Then GetOpenFilename("Excel Files (*.xls),*.XLS", 1, "Import ") 'code to import file to excel - called from ModGLData

command button excel not working

I actually managed to get it working after many hours of trying! But much more satisfaction when u are able to do it on your own! :) OnAction = "'" & ThisWorkbook.Name & "'!ProcessReport" Set cbMenuItem = CommandBars(1).FindControl(Id:=30007).Controls.Add(Type:=msoControlButton) OnAction = "'" & ThisWorkbook.Name & "'!HideForm" 'Add a toolbar command button to hide the form OnAction = "'" & ThisWorkbook.Name & "'!ShowForm" 'Add a toolbar command button to show the form 'called from Workbook_Open event procedure Make sure you declare all variables before they are used. You could add it to the same procedure that generates the commandbar ( CreateToolbar). OnAction = "'" & ThisWorkbook.Name & "'!CellsToText" 'called from Workbook Open event procedure 'set up toolbar to use the addin's functions 'deletes the toolbar when the addin is closedĪpplication.CommandBars(sToolbarName).Delete Private Sub Workbook_BeforeClose(Cancel As Boolean) Use the example below but be sure to change "!CellsToText" to a sub in your workbook, keep the ! at the beginning.Ĭonst sToolbarName As String = "myToolbar" The sub must be in a module and must be public. The OnAction property points to the name of the sub thats called when the button is pressed. When your workbook closes you need to remove the command bar.ģ. When the workbook opens you need to build the command bar and add it to Excel's bars.Ģ. There are a couple of points worth noting.ġ. There's code below that shows you how to do it.















Command button excel not working