Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
CommandBars
My application is a stand alone program that works with EXCEL.
What I want is a toolbar that when selected by EXCEL users, launches my program. My previous approach was to have the user start my program first, then it would launch EXCEL, create my toolbar and create a code module (and even load the users desired workbooks). So I see how to create a PERMANENT toolbar, but where is the code stored? I used to save it in a module named after my program. After createing the permanent commandbar,I exit my program, and EXCEL. When I restart EXCEL, my toolbar is there but when I click on any of the commandbar controls, it wont run because it cant find my code. Thanks gh |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
CommandBars
Hi Garry,
My application is a stand alone program that works with EXCEL. What I want is a toolbar that when selected by EXCEL users, launches my program. Distribute a small Excel addin that your users install. That adds the menu item and handles the OnAction call by starting your app. Regards Stephen Bullen Microsoft MVP - Excel www.BMSLtd.ie |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
CommandBars
Synchronicity!
I got the idea to try an add-in this afternoon. Of course, I'm stuck. This add-in code will be generated into an xla created by myapp.exe program during the installation proceedure. (All because we don't know the path to myApp since the user could install it anywhere!) The desired behaviour is: 1. when user selects this add-in, a Permanent commandbar is created. 2. when user clicks button on commandbar, myapp is launched 3. when user unselects this add-in, the commandbar is removed. Please recommend a better approach if you wish. (I suppose I should check if commandbar exists before creating it.) I just cant figure out what is the prefix (? instance?) of the current running Excel. Private Sub Workbook_AddinInstall() 'create PERMANENT toolbar Dim cbar As CommandBar, cbct1 As CommandBarControl MsgBox "install myAppTB" 'create myApptool bar as permanent 'error in next line- Me is wrong, so is Application, what should it be? Set cbar = Me.CommandBars.Add("MyAppTB", msoBarTop, False, False) cbar.Visible = True 'add MyApp button Set cbct1 = cbar.Controls.Add(Id:=1) '(Type:=msoControlButton) cbct1.Style = msoButtonCaption cbct1.Caption = "Launch MyApp" cbct1.OnAction = "Launch" cbct1.Visible = True 'release all objects Set cbct1 = Nothing Set cbar = Nothing End Sub Private Sub Workbook_AddinUninstall() 'delete PERMANENT toolbar MsgBox "Uninstall myappTB" 'have not figured this out yet" End Sub Private Sub launch() MsgBox "launching myApp" 'shell "c:\myapp\myapp.exe 1 2 3", vbNormal End Sub Thanks again Garry http://www.visualstrongtype.com Uncover nasty spreadsheet errors *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
CommandBars
Hi Garry,
Private Sub Workbook_AddinInstall() 'create PERMANENT toolbar Dim cbar As CommandBar, cbct1 As CommandBarControl MsgBox "install myAppTB" 'create myApptool bar as permanent 'error in next line- Me is wrong, so is Application, what should it be? Set cbar = Me.CommandBars.Add("MyAppTB", msoBarTop, False, False) Application should work fine. Normally, I'd delete the toolbar beforehand, just in case it's already the On Error Resume next Application.Commandbars("MyAppTB").Delete On Error Goto 0 Set cbar = Me.CommandBars.Add("MyAppTB", msoBarTop, False, False) Private Sub Workbook_AddinUninstall() 'delete PERMANENT toolbar MsgBox "Uninstall myappTB" 'have not figured this out yet" On Error Resume next Application.Commandbars("MyAppTB").Delete End Sub Hope that helps Regards Stephen Bullen Microsoft MVP - Excel www.BMSLtd.ie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving CommandBars | Excel Discussion (Misc queries) | |||
Disable Commandbars | Excel Programming | |||
How to attach commandbars with VBA | Excel Programming | |||
CommandBars | Excel Programming | |||
Built In CommandBars | Excel Programming |