VBA Macro Errors

O

orourksj

I have created a macro that will accomplish some client side validation of
some data. Occasionally the macro will error on Workbook_Open subroutine. I
choose Debug and in the editor I receive the error 'Variable Not Defined' and
the variable xlSortNormal is highlighted. My initial thought, since it was
being opened from Outlook as an attachment is that that macro is not
recognizing the excel objects because it was opened from Outlook. However, I
then saved the file to the dasktop and reopened it and still received the
error. If I open the file several more times the error will disappear. How
can I determine the root cause to repair this problem?
 
D

Dr. Stephan Kassanke

orourksj said:
I have created a macro that will accomplish some client side validation of
some data. Occasionally the macro will error on Workbook_Open subroutine.
I
choose Debug and in the editor I receive the error 'Variable Not Defined'
and
the variable xlSortNormal is highlighted. My initial thought, since it was
being opened from Outlook as an attachment is that that macro is not
recognizing the excel objects because it was opened from Outlook. However,
I
then saved the file to the dasktop and reopened it and still received the
error. If I open the file several more times the error will disappear. How
can I determine the root cause to repair this problem?

Hi,

not eliminating the source but it should work. If xlsortnormal is the only
variable not recognized, a solution might be to replace xlsortnormal by it's
value (0).

Stephan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top