![]() |
using one macro to edit another
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) ? -- WinXP - Office2003 (Italian) |
using one macro to edit another
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. "David Macdonald" wrote: 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) ? -- WinXP - Office2003 (Italian) |
All times are GMT +1. The time now is 12:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com