Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear all,
I build the new workbooks from scratch and would like to copy some VB code to the new workbook(s). I am trying to copy the following code to the new workbook ("thisworkbook" module) as discussed and posted in "How to write code to module" (03/04/03). Private Sub Workbook_Activate() Application.Run "TPBQ11.xls!CrMn" End Sub This is the sad attempt I made which does not work: Sub test() Application.VBE.MainWindow.Visible = False Set TempModule = ActiveWorkbook.VBProject.VBComponents ("Thisworkbook") strCode = "Private Sub Workbook_Activate()" & vbCr & _ "On Error Resume Next" & vbCr & "Application.Run " & Chr(34) & "TPBQ11.xls!CrMn" & Chr (34) & vbCr & _ "End Sub" TempModule.CodeModule.AddFromString strCode End Sub I cannot find anything that explains how to do this and cannot make the sample to wrk. Any help would be really appreciated. Kind reagards. John |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook | Excel Worksheet Functions | |||
Excel-how to link source workbook to copy of destination workbook | Excel Worksheet Functions | |||
Help...Code to copy sheet from closed workbook | Excel Discussion (Misc queries) | |||
Copy empty cells from one workbook to another - Code | Excel Discussion (Misc queries) | |||
copy and paste using code from workbook to workbook | Excel Discussion (Misc queries) |