Question : Shell command doesn't work on all computers

I have the following code to transfer data from Acess to Excel

    DoCmd.TransferSpreadsheet acExport, 8, "zCommentary", "C:\WFReports_CG.xls", True, ""
'   End If
     
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\excel.exe ""C:\WFReports_CG.xls""", vbMaximizedFocus)

It works well on most computers but I get the following message from 2 of them:

File not found

Any idea why?

Answer : Shell command doesn't work on all computers

i have had to deal with this in programs i have made as well.
first lest address the issue
the problem is not in the shell command its in the transferspreadsheet command

the bottom line is the transferspreadsheet method cant export to the location c:\ it needs to be a place where you know anyone who uses the program will have the rights to access.

take a look at the sample database i have attached. take a look at the code and see how it builds a path specific to the logged in user. right now it is set to export to the users desktop.  the only files it seems you can be sure a user has rights to is the "my documents" folder and the desktop.

hope this helps
Random Solutions  
 
programming4us programming4us