Error when opening Excel 2010 from webpage.

I have a macro-enabled Excel 2010 workbook application that users can get from our webpage.  When a user clicks the link to get the workbook they are presented with a "File Download" dialog box that asks if they wish to OPEN, SAVE, or CANCEL the file.

If user saves it to their PC all the vba code works just fine, and the application functions as expected.  However, if they select OPEN then some users (not all) are getting runtime errors when the workbook opens.

Can anyone point me in the right direction on how to fix this issue?

All users are using Excel 2010
Who is Participating?
Shanan212Connect With a Mentor Commented:
You have to take note another problem

My computer (eg) have macros enabled. This means, regardless of what file I open, the macro would run.

The default setting is that the user have to enable macros (almost all computers) This would also give an error (I assume)

Again, usually, if any file is opened from inter/intranet locations, it would open as read-only too.

You may alternatively look at the purpose of an 'open-event' macro and try to intergrate it into different macro.

I had similar problems. I moved the open-event macro to a 'before-save-event' macro.

Nowadays, I open the file, then whenever I save it, the macro is run (again this method depends on the purpose of the macro)

Whats yours?
Possibly there are macros that run when the file is opened? (open even macro)

They (macro) maybe looking for a specific directory. Since the file could be opened as read-only, it could result in an error.
The difference is that when a user hits "Open" the file is downloaded to a temp folder and then runs from there.

The reason why this is a problem really depends on the specific errors that users encounter. Could you post the exact error messages/codes?
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

sgtoverlordAuthor Commented:
Thank you for the quick reply.

Yes, there are macros running when the workbook opens.  I have reviewed the code and in no place is a path or folder specified.
The error is not limited to paths although paths are one of the main reasons.

The error could be due to the fact that when opening, the file would/could be opened as read-only...and the macro could not make changes to the file, then also it would give an error
The problem doesn't have to be a hard-coded path in the macro. For instance, some antivirus software (I know specifically of McAfee) prevent running programs from temp folders. There may be other problems running files like file permissions etc. That's why the specific error that the users encounter would be very helpful.
Recommendation would be to always save the file.

If you still like to open the file but without getting errors (in this case, the file may be opened as read-only)
Then, put in this condition (if statement) in your open-event

if ActiveWorkbook.ReadOnly = true then
exit sub
end if

^ In above case, open macro wont run and hence no-errors.
sgtoverlordAuthor Commented:

Attached is a screenshot of the error msg that one of my users gets.  The hard part in fixing this issue is that not all users are getting errors.  I, myself, do not get the error.  Further, it appears that different users are getting different errors.  arrrrgh.

For instance, some antivirus software (I know specifically of McAfee) prevent running programs from temp folders
Funny, we do actually use McAfee.  But wouldn't a McAfee popup fire off if it was stopping a program/code from running?
urzicaConnect With a Mentor Commented:
Yes McAfee should say something.. I would check anyway in the settings/rules. I Googled it a bit and there's supposed to be something like "Prevent common programs from running files from the Temp folder".

However, I agree with Shanan212's recommendation. Since there are several errors, why not let users run the document only if they save it first? You can add an If statement to your macro that can check first if the document is running from a temp folder, and if so exit sub and notify the user via a message box.
sgtoverlordAuthor Commented:
I just checked the McAfee protection log, and it shows that this program would have been blocked (due to temp internet folder) but rule is not enforced at this time.
sgtoverlordAuthor Commented:
However, I agree with Shanan212's recommendation. Since there are several errors, why not let users run the document only if they save it first?
I agree with both of you.  Unfortunately, the business owner of our project has made this a functional requirement.  I am trying to push back, but my guess is that they will not accept that it can not be done. arrrgh.


Does anyone know how to make a macro-enabled workbook application operate normally if opened from an internet location? (it actually is opening from our intranet location)
sgtoverlordAuthor Commented:
Though I didn't get the solution for which I was searching, I will divide the points amongst you two for participating.  

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.