Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
gerhardl
Creator II
Creator II

Macro Fails without showing an error

Hi There,

I have a QlikView file that runs macros using OnOpen Triggers.

The macros are always triggered, but sometimes they fail without showing an error. Instead of executing, the edit module opens up. No error is shown anywhere. It just stays there until I manually click OK, at which point the other macros (which saves the file and exists) runs. I then have to re-open the QV file, and manually run the macro from a button. This works 90% of the time, but sometimes also just opens the Edit Module screen. I then press the button again and it works.

This is driving me crazy. This macro creates an excel report, and the rest of my daily scripts are all dependent on this report to finish.

It runs perfectly most of the time, and then sometimes fails. It seems to happen more often when the whole script executes later during the day (usually it executes early morning, but sometimes only in the afternoon) - but it's not like the PC is busier then than it is in the morning, so no idea what this could have to do with it.

Please send me any ideas or questions you may have. I have tried sleeping and WaitForIdle within the macro to ensure I am not overworking it - no luck.

Gerhard

3 Replies
marcus_sommer

Other windows processes could disturb your execution. I had have such case whereby the windows shadow copies interrupted my task - I found it out with many looks in the eventlogs ....

Perhaps a "On error resume next" statement could it also solved ....

- Marcus

gerhardl
Creator II
Creator II
Author

Hi Marcus,

I'm not sure how and where to do that - can you perhaps give me some guidance?

Attached is the macro code if that helps.

marcus_sommer

Nothing special regognizable. You are sure that by access always all sheets existings and visible?

What could be helpful to find the cause?

- XLApp.Visible = true

- allocation the sheets not among themselves - first if it needed

- before using a sheet activate it (XLSheetX.Activate)

- create a special sheet in this document with error messages after each / x steps - like msgbox, only in a separate sheet

 

- Marcus