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).]
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).]