Get reference to a file opened in another instance of XL

X

XP

Using Office 2003;

Generic:
I need to loop thru all open MS-Excel files in another instance of XL with
the object in mind of getting a reference to a particular file opened as a
template. I can positively identify the template file by the contents of
certain cells in the template.

Specific:
The user will be opening an Oracle Financials, Fixed Asset (CPR) ADI
spreadsheet which always opens in a new instance of XL. I need to get a
reference to this spreadsheet and populate it with data from an array.

I can do all of this just fine, but it's the reference to the other instance
that is a challenge. Any help would be appreciated.
 
G

Gary Brown

Assuming that both instances of Excel use your Windows Registry, how about...
in the 1st instance of excel, put the filename you want the 2nd instance to
know about into the registry and then
in the 2nd instance of excel, take the filename out of the registry and open
the file or whatever?

Excel puts the information into...
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\


Examples:

'put data in registry in a macro in 1st instance
SaveSetting APPNAME:="MyFileName", _
section:="FileName", Key:="Value", _
setting:=ActiveWorkbook.FullName
- - - - - - - - -

'get data out of registry using a macro in 2nd instance
strMyFileName = GetSetting(APPNAME:="MyFileName", _
section:="FileName", Key:="Value")

'open the file in the 2nd instance
Workbooks.Open Filename:=strMyFileName
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top