LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Macro when loading addin

I have created an AddIn that cointains custom functions and also a
code segment that creates a tool bar that cotains a macro that copies
the VBE module from the xla file to the active workbook.
The problem is that I dont know how to display the toolbar when the
add-in is loaded. In other words, I want the tool bar to be displayed
automatically once I have loaded the add-in. This the code I wrote.

This bugged me the entire day yesterday and I could not figure it out.

Mary


Sub CopyModule()
Dim Name22 As Variant
Dim test as String
Dim EconLibrary As String



Const tBarName As String = "Tool Bar name"
'Delete CommandBar if it exists
On Error Resume Next
CommandBars(tBarName).Delete
On Error GoTo 0

'create CommandBar
CommandBars.Add Name:=tBarName

'define an object variable to refer to the CommandBar
With CommandBars(tBarName)

'add button use 1 to specify a blank custom face
With .Controls.Add(ID:=1)
.OnAction = "Module1.CopyModule"
.Caption = "CopyModule"
.FaceId = 250

End With

'display the toolbar
.Visible = True
End With


Name22 = AddIns("EconLibrary").FullName

With Workbooks("EconLibrary.xla")
test = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export "test.bas"
End With

ActiveWorkbook.VBProject.VBComponents.Import "test.bas"



End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Addins-Slow loading of each individual Addin using Excel 2007 dplunkett Excel Discussion (Misc queries) 0 May 9th 09 07:16 AM
Analysis Tool Pack addin into Excel and it is not loading pcrxtex Excel Discussion (Misc queries) 3 March 25th 08 10:29 PM
Dynamically Loading Macro with data Fred Charts and Charting in Excel 0 July 6th 06 02:21 AM
addin loading issue howiefan Excel Discussion (Misc queries) 3 December 1st 04 11:10 PM
Changing the Name of an Addin and loading worksheets off a network drive MikeCave[_2_] Excel Programming 0 June 4th 04 10:59 AM


All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"