Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can change the following statement to run a macro so I do not have to
change the spreadsheet name every time it changes. Application.Run "'Salesman pay 2.9.xls'!Midmonthnumbersmove" 'Salesman pay 2.9.xls' is the spreadsheet name in this example. I would just like the statement to run the macro Midmonthnumbersmove no matter what the spreadsheet name is. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if this is the active workbook, you don't need the spreadsheet name. is this
in some other workbook? -- Gary "newguyoldguy" wrote in message ... How can change the following statement to run a macro so I do not have to change the spreadsheet name every time it changes. Application.Run "'Salesman pay 2.9.xls'!Midmonthnumbersmove" 'Salesman pay 2.9.xls' is the spreadsheet name in this example. I would just like the statement to run the macro Midmonthnumbersmove no matter what the spreadsheet name is. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can call a macro from an open workbook using....
Call Midmonthnumbersmove -- Cheers Nigel "newguyoldguy" wrote in message ... How can change the following statement to run a macro so I do not have to change the spreadsheet name every time it changes. Application.Run "'Salesman pay 2.9.xls'!Midmonthnumbersmove" 'Salesman pay 2.9.xls' is the spreadsheet name in this example. I would just like the statement to run the macro Midmonthnumbersmove no matter what the spreadsheet name is. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If it is always referring to the activeworkbook, you could use
Application.Run "'" & Activeworkbook.Name & "'!Midmonthnumbersmove" but better would be to set a object variable to the book when you open it, and use that Set oWB = Activewrokbook ... Application.Run "'" & oWB.Name & "'!Midmonthnumbersmove" -- HTH RP (remove nothere from the email address if mailing direct) "newguyoldguy" wrote in message ... How can change the following statement to run a macro so I do not have to change the spreadsheet name every time it changes. Application.Run "'Salesman pay 2.9.xls'!Midmonthnumbersmove" 'Salesman pay 2.9.xls' is the spreadsheet name in this example. I would just like the statement to run the macro Midmonthnumbersmove no matter what the spreadsheet name is. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob,
Why is your way better? What if the workbook was saved with an other name after opening? Please explain. Grtz, Rody "Bob Phillips" schreef in bericht ... If it is always referring to the activeworkbook, you could use Application.Run "'" & Activeworkbook.Name & "'!Midmonthnumbersmove" but better would be to set a object variable to the book when you open it, and use that Set oWB = Activewrokbook ... Application.Run "'" & oWB.Name & "'!Midmonthnumbersmove" -- HTH RP (remove nothere from the email address if mailing direct) "newguyoldguy" wrote in message ... How can change the following statement to run a macro so I do not have to change the spreadsheet name every time it changes. Application.Run "'Salesman pay 2.9.xls'!Midmonthnumbersmove" 'Salesman pay 2.9.xls' is the spreadsheet name in this example. I would just like the statement to run the macro Midmonthnumbersmove no matter what the spreadsheet name is. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Works great! thank you very much for your help!
"newguyoldguy" wrote: How can change the following statement to run a macro so I do not have to change the spreadsheet name every time it changes. Application.Run "'Salesman pay 2.9.xls'!Midmonthnumbersmove" 'Salesman pay 2.9.xls' is the spreadsheet name in this example. I would just like the statement to run the macro Midmonthnumbersmove no matter what the spreadsheet name is. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trying to save spreadsheet with macros??????? | Excel Discussion (Misc queries) | |||
How can I complete a spreadsheet using macros? | Excel Worksheet Functions | |||
How can I complete a spreadsheet using macros? | Excel Discussion (Misc queries) | |||
Copying a spreadsheet with macros | Excel Worksheet Functions | |||
Apllication.OnTime | Excel Programming |