views:

477

answers:

3

I have a web application that is able to open an excel template, push data into a worksheet and send the file to a user. When the file is opened a VBA Macro will refresh a pivot table based on the data that was pushed into the template.

The user receives the standard File Open / Save dialog.

In Internet Explorer (version 6), if the user chooses to save the file, when the file is opened the VBA code runs as expected, however if the user chooses 'Open' then the VBA fails with:

Run-Time error 1004: Cannot open Pivot Table source file.

In all other browsers both open and save work as expected.

It is not in my power to upgrade to a newer version of IE (corporate bureaucracy); Is there anything Ican do to allow the users to open without first saving?

A: 

The option to open or save is a browser selection item, as far as I know it is not possible to override this behavior.

Mitchel Sellers
+1  A: 

Newer versions of Excel really don't like running macros automatically. If you really want to generate an Excel file and send that to your users, build the full file on the server using the COM interface to Excel, or some libraries that can read/write XLS files, and then send the completed file.

thebigjc
A: 

If I had to guess, I'd say it has to do with what zone the file is currently in. Its probably still considered in the "internet zone" when you click Open. VBA shouldn't be running within that zone.

Have a user mark the server website as safe (Control Panel -> Internet Options -> Security -> Trusted Sites -> Sites) and see if that helps.

Will