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: 
udaya_kumar
Specialist
Specialist

Macro gets stuck executing on open of qvw

Hi,

I have a macro in the edit module to increase the width of the pivot table.

That macro I am running it on a field event trigger in document properties.

But that macro gets executed on open of that qvw file, even when I have given that macro to run on field trigger.

Because of the macro getting executed on open of file, the file gets stuck there and cannot do anything after that. I have to force close the process in task manager.

I am not sure why the macro gets executed when I open the file, but I have given that macro to run on a date field event trigger.

Labels (1)
2 Replies
gf
Creator III
Creator III

I use a similar (i think it is) macro to "hide" a column.

I use this macro and it works fine.

sub SetColumnWidth
  dim obj

  set obj = ActiveDocument.GetSheetObject("CH03")
  obj.SetPixWidth (6), 0

end sub

 

Brett_Bleess
Former Employee
Former Employee

What you are likely hitting is a timing issue, and you also should realize anytime you call a macro, you are also forcing single-threading at that point too.  One workaround in these cases can be to use the WaitForIdle API, as that can sometimes address the timing issues.

Regarding the on open issue, check the Document Properties and Trigger tab settings and the OnOpen event to be sure that is not also calling that macro, pretty sure that is what is happening here.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.