Opening an Excel Spreadsheet...

  • Thread starter Thread starter Sapper
  • Start date Start date
S

Sapper

Hi, put a command button on a form to run Excel and open a file, I've tried
it two ways, one works, the other doesn't.
Any ideas why?

Here's the command(s) I use:

1 - "excel.exe E:\All_WO_Data.xls"



2 - "excel.exe \E:\All WO Data.xls"

The first works, the second doesn't, I feel that the spaces in the file
names have something to do with it, because I get the error that it can't
open file All .xls; then can't open file WO .xls; then can't open file Data
..xls.
I've tried it in a sub-directory named E:\work File, this has the same
effect.

Does the spaces have that much effect on the application? If so I've got a
lot of changes to make to my files and greater problems with my
sub-directories names, which are on a server - I cannot change them, they
are fixed by the admin people.

Any suggestions would be really helpful. TIA, Colin
 
In your second version, you have a backslash before the
drive letter -- this makes the path invalid since it will
think you want to start at the root of the default drive.

You can also open the file like this:

Application.Followhyperlink "E:\All WO Data.xls"

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 
I tried removing the backslash and it doesn't work either.
I'm using Access 2000 and I tried the "Insert" a Hyperlink and that works.

Still puzzling though, as to why the other method doesn't work?
Those spaces do make a difference... ... ...

Open to suggestions, is it "fixed" in Access 2003?
Colin.
 
I have always had problems with spaces too -- that is why I
don't ever use them; not in path or filenames, not in field
or table or control names either.

The underscore character provides a bigger seperation anyway ;)

Glad the Hyperlink works for you

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 
Whenever I run into this problem, I revert back to the DOS 8.3 file names.

Try this: "excel.exe E:\AllWOD~1.xls"

This method always works for me!!
 
Back
Top