Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
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