Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If your workbooks have the same macros in them, wouldn't it be as well to
run the macro DoThis() from workbook1? "Rob" wrote: Hello. Here's the scenario... I have one workbook open and I copy specific sheets into a new woorkbook, now both have the same macros in them, what I want to do is use woorkbook1 to switch control to workbook2 and run a macro that is in workbook2. For example: Workbook1 code... Private Sub CommandButton1_Click() 'Select Tabs and Copy Sheets(Array("Info", "Data")).Copy 'Save New Workbook ActiveWorkbook.SaveAs Filename:="WorkBook2.xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False Windows("WorkBook2.xls").Activate 'Use Macro That's In WorkBook2 Call DoThis(WorkBook2.xls) End Sub Here's the Code in WorkBook2.xls: Sub DoThis() WorkBooks("WorkBook2.xls").Close MsgBox("All Done Boss.") End Sub Any Ideas on this? Thanks in Advance. Rob |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
saving macro from workbook to Personal Macro Workbook | Excel Discussion (Misc queries) | |||
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook | Excel Worksheet Functions | |||
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? | Excel Programming | |||
Need a macro to copy a range in one workbook and paste into another workbook | Excel Programming | |||
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please | Excel Programming |