Opening an Excel Spreadsheet...

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
 
S

strive4peace

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
 
S

Sapper

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.
 
S

strive4peace

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
 
N

Neal

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!!
 

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