Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro Problems

Hi

I am trying to run a macro after reload which save a .pdf to a location and also mails the same .pdf to a number of recipients.

The problem I am facing is after reload it does not do the required actions right away it takes me to the Module editor. I don't change anything within the script or security and simply click ok.

I then try and run the macro by using the button and it does the same thing for second time sometimes a third time but then eventually it goes through and completes the actions in producing the .pdf to the folder location and emails the recipients.

Why does it do that as i want to automate this process but with this happening it requires someone to sit there and do the clicking every time.

Anyone have any ideas, your assistance would be greatly appreciated

4 Replies
m_woolf
Master II
Master II

Generally if QlikView opens the macro Editor, it is because of an error in the code. The debugger no longer allows you to step through the code, so I debug the script by adding msgbox lines in the code.

Not applicable
Author

That is my understanding as well but the strange thing is when I run the macro using the button I created it works after about two or three times without changing anything with in the macro Editor.

When the editor pops up I click OK and after a few pop ups it runs fine.

Some days it will pop up once other days multiple times.

m_woolf
Master II
Master II

You can use on error resume next  to trap the err.number and description.

Maybe you need ActiveDocument.GetApplication.WaitForIdle before the code that sometimes causes an error and sometimes doesn't.

Not applicable
Author

Sorry for late response i think it has something to do with the ActiveDocument. I did a test by flipping through the different tabs (5 tabs) once doing this and executing the macro it runs fine.

So i am going to try implementing something with the ActiveDocument and revert back.

Thank you