using one macro to edit another

D

David Macdonald

I'm sure I saw a post here once about doing this but can't find it now.
I have a CommandBar.add macro on startup that loads a bunch of buttons and
associated functions. i.e. a series of

Set Button1 = mybar.Controls.Add(Type:=msoControlButton)
With Button1
.Style = msoButtonIcon
.Picture = LoadPicture(ThisWorkbook.Path & "\FirstPicture.bmp")
.TooltipText = "run the first macro"
.OnAction = "FirstMacro"
End With
Set Button2 = mybar.Controls.Add(Type:=msoControlButton)
........ etc etc etc

All running OK but as different people request functions that are only
needed by 1 or 2 colleagues, the toolbar is getting wider and wider.
I want to give the users some configuration options, such as individually
setting the files in a "frequently used files" menu or deciding which
functions/buttons will be displayed and which not.
What would be the best way to approach this ?

The only way I can think of (with my limited abilities) is through a "setup"
form with check boxes linked to cells in the xlt, but how can I get those
TRUE or FALSE values to determine what parts of the CommandBar creation macro
get used ?
Do I need to create a settings file (txt ?) somewhere and have a macro read
it on startup (and how would I do that) ?
 
J

Joel

See chip pearson website

http://www.cpearson.com/Excel/vbe.aspx

Look At:
Exporting A VBComponent Code Module To A Text File


You can store you macros in a windows folder and then import the BAS (text)
files into your workbook as needed. You can use a dialog box to allow the
user to select the BAS file that you want imported into your project. if you
really want ot get fancy have a form with a multicolumn listbox the has the
description of the macros and the file name where they are located.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top