• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

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
0
sgtoverlord
Asked:
sgtoverlord
  • 5
  • 4
  • 3
2 Solutions
 
Shanan212Commented:
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.
0
 
urzicaCommented:
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?
0
 
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Shanan212Commented:
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
0
 
urzicaCommented:
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.
0
 
Shanan212Commented:
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.
0
 
sgtoverlordAuthor Commented:
Urzica,  

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?
Runtime-error-1004.JPG
0
 
urzicaCommented:
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.
0
 
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.
0
 
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.

So.

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)
0
 
Shanan212Commented:
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?
0
 
sgtoverlordAuthor Commented:
Though I didn't get the solution for which I was searching, I will divide the points amongst you two for participating.  

Thanks.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now