Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default "Workbooks.Open" fails with 2007??

I am automating Excel through Word VBA. The code is breaking at the
line to open the Excel workbook. THe code has worked great through
Word/Excel 2003 - but the 2007 update was pushed over the weekend and
now it breaks on Workbooks.Open. No other Excel instances are open
when this code runs, and the workbook can be opened with a double-
click with no errors.

Set objExcel = New Excel.Application
objExcel.Visible = True
Set objWkbk = objExcel.Workbooks.Open(FileName:=strLookIn &
"\MyList.xls")

The error is "Method 'Open' of object 'Workbooks' Failed."

Does anyone have any insight on this?

Ed
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default "Workbooks.Open" fails with 2007??

Unless you specifically save the file as a 2003 format, it will require a
four digit file extension to open it. If it has macros it will be .xlsm if
it does not it will be .xlsx. To be sure, check in the file open dialog box
with file extensions set to show.

"Ed from AZ" wrote:

I am automating Excel through Word VBA. The code is breaking at the
line to open the Excel workbook. THe code has worked great through
Word/Excel 2003 - but the 2007 update was pushed over the weekend and
now it breaks on Workbooks.Open. No other Excel instances are open
when this code runs, and the workbook can be opened with a double-
click with no errors.

Set objExcel = New Excel.Application
objExcel.Visible = True
Set objWkbk = objExcel.Workbooks.Open(FileName:=strLookIn &
"\MyList.xls")

The error is "Method 'Open' of object 'Workbooks' Failed."

Does anyone have any insight on this?

Ed

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default "Workbooks.Open" fails with 2007??

The file was originally an Excel 2000 file, which opened fine in XL
2000 and 2003. All the code is now in a Word 2000/2003 document,
which is being opened in an Office 2007 (Win XP Pro) environment and
is trying to open the original XL file in XL 2007. The XL file does
have macros.

Ed


On May 19, 3:39*pm, JLGWhiz wrote:
Unless you specifically save the file as a 2003 format, it will require a
four digit file extension to open it. *If it has macros it will be .xlsm if
it does not it will be .xlsx. *To be sure, check in the file open dialog box
with file extensions set to show.



"Ed from AZ" wrote:
I am automating Excel through Word VBA. *The code is breaking at the
line to open the Excel workbook. *THe code has worked great through
Word/Excel 2003 - but the 2007 update was pushed over the weekend and
now it breaks on Workbooks.Open. *No other Excel instances are open
when this code runs, and the workbook can be opened with a double-
click with no errors.


Set objExcel = New Excel.Application
objExcel.Visible = True
Set objWkbk = objExcel.Workbooks.Open(FileName:=strLookIn &
"\MyList.xls")


The error is "Method 'Open' of object 'Workbooks' Failed."


Does anyone have any insight on this?


Ed- Hide quoted text -


- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default "Workbooks.Open" fails with 2007??

We did save the Excel file as a xlsm file.

What we discovered was that either as xls or xlsm, the file _does_
open. It's just that the Word code can't create the workbook object.
The error comes up that the Open Method failed, but the open works -
setting the object fails.

Ed


On May 19, 4:37*pm, Ed from AZ wrote:
The file was originally an Excel 2000 file, which opened fine in XL
2000 and 2003. *All the code is now in a Word 2000/2003 document,
which is being opened in an Office 2007 (Win XP Pro) environment and
is trying to open the original XL file in XL 2007. *The XL file does
have macros.

Ed

On May 19, 3:39*pm, JLGWhiz wrote:



Unless you specifically save the file as a 2003 format, it will require a
four digit file extension to open it. *If it has macros it will be .xlsm if
it does not it will be .xlsx. *To be sure, check in the file open dialog box
with file extensions set to show.


"Ed from AZ" wrote:
I am automating Excel through Word VBA. *The code is breaking at the
line to open the Excel workbook. *THe code has worked great through
Word/Excel 2003 - but the 2007 update was pushed over the weekend and
now it breaks on Workbooks.Open. *No other Excel instances are open
when this code runs, and the workbook can be opened with a double-
click with no errors.


Set objExcel = New Excel.Application
objExcel.Visible = True
Set objWkbk = objExcel.Workbooks.Open(FileName:=strLookIn &
"\MyList.xls")


The error is "Method 'Open' of object 'Workbooks' Failed."


Does anyone have any insight on this?


Ed- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable "New" "open" menu items in Excel 2007 Aruna Akella Excel Programming 1 March 26th 08 05:13 AM
"Lines on 2 Axes" fails on Excel 2007 Sumit Excel Programming 1 December 21st 07 08:56 AM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" Luc[_3_] Excel Programming 2 September 28th 05 08:37 PM
VB Editor doesn't "recognize" open workbooks mikelee Excel Programming 1 August 20th 03 02:49 PM
Where can I find other arguments & desc to the Workbooks.open("myfile.xls") cmd? wellie Excel Programming 0 July 9th 03 11:32 PM


All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"