Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 3
Default filename!macroname as variables

Hello everyone,

I know when you call a macro which lies in an external excel file, you reference it by: filename!macroname, so it will look like something below:

oExcel.Run "'D:\myExcelFile.xls'!myMacro"

Now i want to put the file name and macro name into a variable, as it can change, but i need to know the SYNTAX to do this; sample code is below:

Dim myFileName As String
Dim myMacro As String

myFileName = "'D:\myExcelFile.xls'"
myMacro = "myMacro"

oExcel.Run THEN I DONT KNOW THE SYNTAX, eveything i tried hast worked.

Thanks in advance,
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
filename.xls:1 and filename.xls:2 Christina C. Excel Discussion (Misc queries) 7 November 27th 07 10:39 PM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
+ in filename mkrefting Excel Discussion (Misc queries) 0 October 24th 06 07:44 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM


All times are GMT +1. The time now is 02:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"