I'm trying to write a macro which exports 2 images of different sheets for every value selected on a field.
I used macros a lot but this time I can't understand the code execution's behaviour. It seems that the statements of my function are not executed in the correct sequence.
For example, I have to activate a sheet and then export it as an image file. (I'm using this horrible practice because ActiveDocument.GetSheetByID("SHxx").ExportBitmapToFile and ActiveDocument.Sheets("sheet name").ExportBitmapToFile don't work if active sheet isn't the same I have to export... another VBS mystery).
Well, the statement which would export the sheet runs before the statement that has to activate the correct sheet and if I insert a wait of x seconds between the two statements, QlikView client stays locked for x seconds before the image is generated and only then the correct sheet is activated.
Have you ever had issues like this before? How can I control the correct sequence of statements forbidding execution of one before the previous has finished?