Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Possible error in VBA Workbooks.Open method for xlsx file

I have an application that opens Excel files and loads data into an Access
database. This app runs unattended and so I have to take various precautions
to ensure that Excel doesn't produce any prompts that require human input.
One such situation is where a user decides to password protect the file. If I
try to open this in code without the password, Excel will pop up a dialog box
prompting for the password and everything will stop until somebody goes to
the server and answers it. To avoid this, I supply a password like so: set
wkb = Excel.Workbooks.Open(FileName:= " test.xls ", Password:="password") If
the file isn't password protected, Excel just ignores that parameter. If it
is password protected (and the password isn't "password") then I get a 1004
error and can email somebody to fix it and then skip to the next file. This
works fine for .xls files but there is a difference with .xlsx files. If the
file has a workbook protection password set (which it does), then the .xlsx
format file returns the 1004 error (no matter the value of the password,
including "password") whereas the equivalent file saved in legacy .xls format
does not fail. So to handle .xlsx files I will need to remove the password
parameter and risk the task hanging... Anyone have an idea about this or have
I discovered an Excel bug?
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
Method "Method 'Open' of object 'Workbooks' failed [email protected] Excel Programming 2 June 2nd 10 05:28 PM
How to open an .xlsx file with Excell chuckmlr1508 Excel Worksheet Functions 2 January 26th 09 01:35 PM
can't open .xlsx file in excel 2007 Amy Lim Excel Discussion (Misc queries) 3 October 18th 07 01:24 PM
Can't open .xlsx file in excel 2007 Amy Lim Excel Discussion (Misc queries) 1 October 18th 07 03:45 AM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM


All times are GMT +1. The time now is 10:28 AM.

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

About Us

"It's about Microsoft Excel"