View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Opening a file with a space in the name?

You must have misspelled the name (maybe it has two spaces).

This worked fine for me (demo'd from the immediate window)

set wkbk = Workbooks.Open("C:\Data\Data1\Data2\A B C D E F.xls")
? wkbk.Name
A B C D E F.xls

--
Regards,
Tom Ogilvy

"Maury Markowitz" wrote in
message ...
This line works...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

this one returns a 1004 error...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

getting "smart" I tried...

Set working = Workbooks.Open("""L:\theFolder\The Email.xls""")

The file in question WILL have a space in the name when we receive it. Is
there some trick to opening the file when there's a space in the name?

Maury