access open excel file

G

Guest

Hi all, I have got little problem. I want open excel file from form in
access. I have got button and in VB code i have : this is some from code

stAppName = "Excel.exe C:\DBPrametTOOLS\vzorce.xls"

its absolute path, but i want make relative path because i want in future
move databaze with excel file to another computer.

here is my idea how to make it:
dbpath = CurrentProject.Path
fpath = dbpath & "\vzorce.xls"

and now i want use stAppName="excel.exe" & fpath

but its wrong, program said cannot found file, please can you help me set
right relative path ? thx you
 
G

Guest

Instead of using the excel.exe ... you should use the followhyperlink method

application.followhyperlink "c:\temp\test.xls"

try something like

dbpath = CurrentProject.Path
fpath = dbpath & "\vzorce.xls"

application.followhyperlink fpath
 

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