Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macros to make macros
The vba code I am working with generates a file with multiple worksheets. As
the worksheets are created, names are assigned. I would like to add some code to ThisWorkBook for the created file so that when a specific sheet in the new workbook is activated, a toolbar appears. I am not sure how to write a code that will write code in another file. Any thoughts? TIA Papa J |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macros to make macros
Chip Pearson has some instructions on how to remove code (or add code) on the
fly. http://www.cpearson.com/excel/vbe.htm But I would take a different approach. Are you showing the toolbar based on the name of the worksheet? If yes, are they nicely named--always begin with the same string (or always contain the same indicator)? Maybe just modifying the code to look for that indicator would be enough: Option Explicit Private Sub Workbook_SheetActivate(ByVal Sh As Object) If LCase(Sh.Name) Like "indicator*" Then Application.CommandBars("custom1").Visible = True Else Application.CommandBars("custom1").Visible = False End If End Sub Papa Jonah wrote: The vba code I am working with generates a file with multiple worksheets. As the worksheets are created, names are assigned. I would like to add some code to ThisWorkBook for the created file so that when a specific sheet in the new workbook is activated, a toolbar appears. I am not sure how to write a code that will write code in another file. Any thoughts? TIA Papa J -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macros to make macros
I like the idea. I'll give it a shot.
Thanks "Dave Peterson" wrote: Chip Pearson has some instructions on how to remove code (or add code) on the fly. http://www.cpearson.com/excel/vbe.htm But I would take a different approach. Are you showing the toolbar based on the name of the worksheet? If yes, are they nicely named--always begin with the same string (or always contain the same indicator)? Maybe just modifying the code to look for that indicator would be enough: Option Explicit Private Sub Workbook_SheetActivate(ByVal Sh As Object) If LCase(Sh.Name) Like "indicator*" Then Application.CommandBars("custom1").Visible = True Else Application.CommandBars("custom1").Visible = False End If End Sub Papa Jonah wrote: The vba code I am working with generates a file with multiple worksheets. As the worksheets are created, names are assigned. I would like to add some code to ThisWorkBook for the created file so that when a specific sheet in the new workbook is activated, a toolbar appears. I am not sure how to write a code that will write code in another file. Any thoughts? TIA Papa J -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
make macros in charts | Charts and Charting in Excel | |||
make macros usable! make instructions in plain english !!!! | Excel Worksheet Functions | |||
weird saving of a document with macros resulting with macros being transfered to the copy | Excel Programming | |||
Combining Macros to make one Macro. | Excel Programming | |||
thanks TOM. How to run macros and make the workbooks invisible | Excel Programming |