runtime error 1004 when opening excel file via VBA in a browser

  • Thread starter Thread starter Ken Hunter
  • Start date Start date
K

Ken Hunter

Hello,

I have an excel spreadsheet that uses a macro to open
another excel spreadsheet via Workbooks.Open(filename)

On my local drive this works fine and it opens the second
file, runs the query, and closes it without complaint.
When I run it via a network drive it works fine as well.

However, when I try to run it via a browser (i.e. put the
file on a web server and then open the url as
http://www.whatever.com/myfile.xls") and then run the
macro I get a runtime error 1004 stating "Method 'Open' of
object 'Workbooks' failed".

Any idea what is causing this?

To complicate matters more, when it gives me the error it
gives me the option of "End" or "Debug". If I click Debug
it brings up the code window. If I then click Run without
making any changes it runs properly.

Help!

Thanks,

Ken Hunter
 
What version of excel is installed on the webserver is
irrelevant as the file is being opened on the client's pc.
(for the record excel is not even on the webserver).

Let me put the problem another way. If you have a file
called c:\file1.xls with a button that does
workbooks.open "c:\file2.xls". Open IE and drag file1.xls
into the browser - it will not work.

And no - making IE load excel outside the browser is not
an option - it is a locked down desktop.

Ken
 
Hi,

If dragging an xls file to the browser window doesn't work then it's most
likely Excel isn't installed properly on the client. It could be the
browser as well. Try doing a repair installation from the control panel.

Thanks,

Jim

Jim Vita
Microsoft Developer Support

Microsoft Security Announcement: Have you installed the patch for Microsoft
Security Bulletin MS03-026? If not Microsoft strongly advises you to review
the information at the following link regarding Microsoft Security Bulletin
MS03-026 http://www.microsoft.com/security/security_bulletins/ms03-026.asp
and/or to visit Windows Update at http://windowsupdate.microsoft.com to
install the patch. Running the SCAN program from the Windows Update site
will help to insure you are current with all security patches, not just
MS03-026.

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top