Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Excel from Access 1

Status
Not open for further replies.

arryb

Programmer
Oct 27, 2003
27
GB
I have some code related to a button which opens a specified file in excel.

excelpath = "C:\Program Files\Microsoft Office\Office\Excel.exe"
filepath = "C:\Aarons Folder\Interconnects\Interconnects_FileReader_V2.xls"

Call Shell(excelpath & " " & filepath, vbNormalFocus)

This works okay when i have no spaces in the filepath but cannot find the file when it has spaces.

Any Ideas on how to solve this.
 
Hi,

You need to replace the spaces with: %20. You can use the replace function to do it in code:

excelpath = Replace(excelpath," ", "%20")

Dean :)
 
This doesn't seem to work.
The replace function isn't compatible with Access 97 and substituting the space with %20 means the file cannot be found.

Pants???
 
Danvlas,

Thanks, That worked a treat.

You're a star, so have one!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top