Opening Excel Workbook

ciao

New member
Local time
Today, 20:50
Joined
Feb 8, 2002
Messages
5
I am trying to open a certain Excel workbook. I have written code that lets me know which directory the workbook is contained in. The file name is then stored in a variable. I want to open Excel and have it open this workbook using the variable. I am running into problems getting the DDEExecute command to work with the variable ex:

XCL = DDEInitiate("Excel", "System")
If Err Then
Err = 0
Shell "Excel.exe " & strvoucher, 3
If Err Then Exit Function
XCL = DDEInitiate("Excel", "System")
End If
XCL = DDEInitiate("Excel", "System")
DDEExecute XCL, "[Open(strvoucher)]"

Where strvoucher is the string containing my file location.
If Excel is not open it runs fine, but if Excel is open it does nothing. I know that this is pretty simple, but I can't figure out how to do it, any help would be greatly appreciated!

Scott Griffin

[This message has been edited by ciao (edited 03-12-2002).]

[This message has been edited by ciao (edited 03-12-2002).]
 
At risk of sounding like a moron, why don't you just use the followhyperlink command?

FollowHyperlink strvoucher

I'm sure the above is too simple since I didn't understand half the code you wrote below, but it does seem to open an excel document even when excel is already open.
 

Users who are viewing this thread

Back
Top Bottom