Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
passing strings
I need some help with argument passing....
I have a macro (let's call it TEST()) that I will run from a Master file. The results will go in seperate files. The macro TEST() would be the same for each file with the exception that the file name would change ex : Windows("Rider.xls").Activate the rest of the macro (TEST()) does not varie from file to file. So from my master file I would have calls to this macro (TEST()) and pass the name of the file I want to generate (eg. Rider1, Rider2, Rider3, ect.) I could then simply call Windows("STRING").Activate from the macro . STRING being the string I would pass from the master file What is the easiest (or pretiest) way to do this? thanks Pabs --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
passing strings
Pabs,
Declare the Test macro with an argument like Sub Test(WinName As String) Windows(WinName).Activate ' rest of your code here End Sub Then, call the code with something like Test WinName:="Book1.xls" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "pabs" wrote in message ... I need some help with argument passing.... I have a macro (let's call it TEST()) that I will run from a Master file. The results will go in seperate files. The macro TEST() would be the same for each file with the exception that the file name would change ex : Windows("Rider.xls").Activate the rest of the macro (TEST()) does not varie from file to file. So from my master file I would have calls to this macro (TEST()) and pass the name of the file I want to generate (eg. Rider1, Rider2, Rider3, ect.) I could then simply call Windows("STRING").Activate from the macro . STRING being the string I would pass from the master file What is the easiest (or pretiest) way to do this? thanks Pabs --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
passing strings
Sub Main
for each bk in Application.Workbooks Test bk.Name Next End Sub Sub Test(sStr as String) ' note that sStr does not have double quotes around it. Windows(sStr).Activate End Sub -- Regards, Tom Ogilvy "pabs" wrote in message ... I need some help with argument passing.... I have a macro (let's call it TEST()) that I will run from a Master file. The results will go in seperate files. The macro TEST() would be the same for each file with the exception that the file name would change ex : Windows("Rider.xls").Activate the rest of the macro (TEST()) does not varie from file to file. So from my master file I would have calls to this macro (TEST()) and pass the name of the file I want to generate (eg. Rider1, Rider2, Rider3, ect.) I could then simply call Windows("STRING").Activate from the macro . STRING being the string I would pass from the master file What is the easiest (or pretiest) way to do this? thanks Pabs --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
find and replace numeric strings in larger text strings | Excel Worksheet Functions | |||
How to find number of pairs of strings from list of strings? | Excel Worksheet Functions | |||
Finding strings within strings | Excel Programming | |||
Finding strings within strings | Excel Programming | |||
passing strings | Excel Programming |