Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Variable available to all open xl files

Is there a way to declare a variable that will be recognized by open excel
files? For example if I have 2 files and in File1 I set a variable
vAllFilesVariable = "It works" then if I am in File2 and put MsgBox
vAllFilesVariable on the SelectionChange is there a way to make it so it
would return the variable?

Thank you,

Steven
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default Variable available to all open xl files

hi, Steven !

Is there a way to declare a variable that will be recognized by open excel files?
For example if I have 2 files and in File1 I set a variable vAllFilesVariable = "It works"
then if I am in File2 and put MsgBox vAllFilesVariable on the SelectionChange
is there a way to make it so it would return the variable?


without linked references between vba-projects ?... (one way)

File1 (the file with the variable)
- standard code module:
Public vAllFilesVariable As String
Function WhatsOnMyVariable() As Variant
WhatsOnMyVariable = vAllFilesVariable
End Function

- workbook_open event
Private Sub Workbook_Open()
vAllFilesVariable = "It Works !!!"
End Sub

File_X
- standard code module
Sub VariableOtherWorkbook()
MsgBox Application.Run("file1.xls!whatsonmyvariable")
End Sub

hth,
hector.


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
Open files with a variable name in a folder get name in B1 and sav Les Excel Programming 21 May 30th 08 05:06 PM
How to change default Open/Files of Type to "Microsoft Excel Files Tammy Excel Discussion (Misc queries) 2 January 14th 08 11:06 PM
HOW TO GET OVER WITH THIS ANNOYING LINKED FILES MSG BOX WHEN I OPEN FILES WHICH HAS LINKS CAPTGNVR Excel Programming 4 February 8th 07 07:13 PM
Macro to open *.dat files and save as .txt (comma delimited text files) [email protected] Excel Programming 2 November 30th 05 05:50 AM
Using a variable name as part of a file pathname to open many files trickydick Excel Programming 1 December 11th 03 08:10 PM


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

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"