Excel 2007 - Workbook.Open Question

B

Barb Reinhardt

I have the following line that works in PowerPoint 2003, but doesn't in
PowerPoint 2007. I'm asking here because I think it's more of an Excel
question.

Set XLBook = XLApp.Workbooks.Open(sFile, UpdateLinks:=False)

I have everything dimensioned as needed. The error I'm getting is as
follows:

Run-time error '1004':

Excel cannot open the file 'FILENAME.xlsm'
because the file format or file extension is not valid. Verify that the file
has not been corrupted and that the file extension matches the format
of the file.

Thanks,

Barb Reinhardt
 
B

Barb Reinhardt

FWIW, I don't have a problem opening a .xls file when testing the code on
Office 2007.
Thanks,
Barb Reinhardt
 
B

Barb Reinhardt

I'm begining to think that the file I was opening was corrupted. I can open
and close other file.xlsm files.

Barb Reinhardt
 
J

Jim Rech

You will get that error message if a file is not a true XLSM, for instance
if an XLS is renamed. Of course it could be something else.

--
Jim
| I'm begining to think that the file I was opening was corrupted. I can
open
| and close other file.xlsm files.
|
| Barb Reinhardt
|
| "Barb Reinhardt" wrote:
|
| > I have the following line that works in PowerPoint 2003, but doesn't in
| > PowerPoint 2007. I'm asking here because I think it's more of an Excel
| > question.
| >
| > Set XLBook = XLApp.Workbooks.Open(sFile, UpdateLinks:=False)
| >
| > I have everything dimensioned as needed. The error I'm getting is as
| > follows:
| >
| > Run-time error '1004':
| >
| > Excel cannot open the file 'FILENAME.xlsm'
| > because the file format or file extension is not valid. Verify that the
file
| > has not been corrupted and that the file extension matches the format
| > of the file.
| >
| > Thanks,
| >
| > Barb Reinhardt
| >
| >
 
B

Barb Reinhardt

I've discovered part of my problem. If I save a workbook as a .xlsm with
Workbook_SaveAs code (I think that's it) AND there are named ranges that
Excel 2007 does not like, I get no error and am unable to open the workbook
again. Ain't life grand?

Barb Reinhardt
 

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