![]() |
Opening a file with a space in the name?
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 |
Opening a file with a space in the name?
So you mean the file received may or may not have space?
If this is the case then try:- On Error Resume Next Set working = Workbooks.Open("L:\theFolder\TheEmail.xls") If Err < 0 Then Err.Clear Set working = Workbooks.Open("L:\theFolder\The Email.xls") End If On Error GoTo 0 Sharad "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 |
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 |
Opening a file with a space in the name?
Hi Maury,
One thing you can try: 1) Go to Tools | Options, General tab, and make sure "Ignore other applications" is unchecked. If that doesn't work, close Excel and try this: 2) Go to Start | Run in Windows, type "excel /regserver", and click OK. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Maury Markowitz wrote: 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 |
Opening a file with a space in the name?
Perhaps it is not a space, just looks like one. If in Excel you use File +
Save AS, type MY followed by Alt + digits 2 5 5 on the numeric keypad followd by some file.xls, the resulting filename looks like MY file.xls but the character between the Y and the f is NOT a space. "Tom Ogilvy" wrote: 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 |
Opening a file with a space in the name?
"AA2e72E" wrote:
Perhaps it is not a space, just looks like one. If in Excel you use File + Save AS, type MY followed by Alt + digits 2 5 5 on the numeric keypad followd by some file.xls, the resulting filename looks like MY file.xls but the character between the Y and the f is NOT a space. I think this is the problem. I wiped out the filename and retyped it with the space and it worked ok! Maury |
All times are GMT +1. The time now is 10:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com