LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Passing a variable into a subroutine in a different open workbook

I am trying to pass on a variable called by a subroutine in a macro written
in a different workbook. The variable is the filename of the workbook where
the first macro is written. I didn't get an error with both of the following
lines of code, but it just stopped running. Can you help?

FirstWb = ThisWorkbook.Name
ActiveWbMacro = SecondWb &* "!RunMacro2(""" & FirstWb & """)"
Application.Run ActiveWbMacro

I also tried:
ActiveWbMacro = "'" & SecondWb &* "'!RunMacro2(""" & FirstWb & """)"
Application.Run (ActiveWbMacro)

Thanks for your help!
 
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
Call a subroutine using variable subroutine name dhstein Excel Discussion (Misc queries) 3 July 26th 09 08:28 PM
How to check workbook is already opened before passing the workbook obj to a subroutine in Word Bon Excel Programming 2 January 19th 06 09:54 AM
Auto Open and Passing variable value(s) to MS Word Sony[_2_] Excel Programming 1 September 29th 03 05:00 AM
Passing a variable to a Worksheet at open time Neil Excel Programming 0 September 18th 03 03:52 PM
Passing a Variable from Worksheet to Workbook Susan Lammi Excel Programming 6 August 3rd 03 01:29 AM


All times are GMT +1. The time now is 04:22 PM.

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

About Us

"It's about Microsoft Excel"