Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Passing a variable between workbooks

Is possible to pass a variable between workbooks? I can do it by stroing
the value of the variable to a cell or range then inside that workbook.
Then through the second workbook i go to that cell or range in the first
workbook and store it to a cell or range in the second workbook. Then i
create a variable in the second workbook which has a value of that cell or
range i just called over from the first workbook. Is there a simple way of
doing this with out storing to cells the calling it across workbooks and
storing to a cell then defining it to a variable in the second work book or
is that the only way? Any suggestion or answers would be great. Sorry if
it sounds confusing.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Passing a variable between workbooks

Rich,

You can have a procedure that accepts a variable that is passed to it.

In Book1.xls:

Sub PassVariableToBook2()
Dim MyStr As String
MyStr = "test"
Application.Run "'Book2.xls'!TryNow", MyStr
End Sub

In Book2.xls:

Sub TryNow(inVar As String)
MsgBox "I just received " & inVar
End Sub

HTH,
Bernie
MS Excel MVP

"Rich Cooper" wrote in message
...
Is possible to pass a variable between workbooks? I can do it by stroing
the value of the variable to a cell or range then inside that workbook.
Then through the second workbook i go to that cell or range in the first
workbook and store it to a cell or range in the second workbook. Then i
create a variable in the second workbook which has a value of that cell or
range i just called over from the first workbook. Is there a simple way

of
doing this with out storing to cells the calling it across workbooks and
storing to a cell then defining it to a variable in the second work book

or
is that the only way? Any suggestion or answers would be great. Sorry if
it sounds confusing.




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
Passing Variable to LINEST RW Excel Worksheet Functions 5 May 24th 05 07:00 PM
Passing variable from one sub to another Medemper Excel Programming 0 February 26th 04 10:23 PM
passing a variable as an argument to a function Drew[_6_] Excel Programming 3 July 25th 03 08:51 PM
Passing a variable to a range statement Mervyn Thomas[_3_] Excel Programming 3 July 25th 03 02:40 PM
Passing a value to a variable from Userform Neal Steiner Excel Programming 1 July 18th 03 09:12 PM


All times are GMT +1. The time now is 01:54 AM.

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"