chestera
asked on
Open excel by vba
Hi EE
I have the following to open a file in excel
Dim xFSO As Object
Dim Tfolder, strMyFile
strMyFile = "C:\AnnualReport\Financial Report.xls "
Tfolder = "C:\Program Files (x86)"
Set xFSO = CreateObject("Scripting.Fi leSystemOb ject")
If Not xFSO.FolderExists(Tfolder) Then
Call Shell("C:\Program Files\Microsoft Office\Office14\excel.exe ""strmyfile""", 1)
Else
Call Shell("C:\Program Files (x86)\Microsoft Office\Office14\excel.exe ""strmyfile""", 1)
End If
excel opens but warns it can't find the file stmyfile. I have an idea the quotes are incorrect. Any help appreciated
chestera
I have the following to open a file in excel
Dim xFSO As Object
Dim Tfolder, strMyFile
strMyFile = "C:\AnnualReport\Financial
Tfolder = "C:\Program Files (x86)"
Set xFSO = CreateObject("Scripting.Fi
If Not xFSO.FolderExists(Tfolder)
Call Shell("C:\Program Files\Microsoft Office\Office14\excel.exe ""strmyfile""", 1)
Else
Call Shell("C:\Program Files (x86)\Microsoft Office\Office14\excel.exe ""strmyfile""", 1)
End If
excel opens but warns it can't find the file stmyfile. I have an idea the quotes are incorrect. Any help appreciated
chestera
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER