Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a macro which copies the data from multiple charts and pastes into an Excel file. To try to minimize the clipboard failure issue I have inserted WaitForIdle commands throughout, as well as the WshShell command to clear the clipboard.
This seems to work pretty well when tested - mainly by using a button to call the macro, but also when testing inside the macro editor.
Now I have added the macro to the OnPostReload trigger, the intention being to call the QVW file from a batch file using the /r flag to reload the data. In this instance, the macro always fails as soon as it hits the WaitForIdle command.
I have tried lots of different ways to work around this, but without coming to an actual solution. I assume the failure has something to do with the fact that the QVW is closed when the macro is running.
If I use the /l flag in the batch file, it works in terms of loading the data and running the macro, but then the file is left unsaved and open, which means the batch file stops and everything is left open on the desktop - I have not tested the effect of this when the batch is next run.
I tried moving the macro to the OnOpen trigger, but this didn't work either. Anyone have any suggestions?
I'm using QV12 SR1
Yes, it could not work with /r but with /l and you need only to add a save/close/quit command after your exports. The following links should be good starting point for your task:
Run-a-macro-on-post-reload
Sending-mails-macro-vbs
- Marcus
Yes, it could not work with /r but with /l and you need only to add a save/close/quit command after your exports. The following links should be good starting point for your task:
Run-a-macro-on-post-reload
Sending-mails-macro-vbs
- Marcus
As Marcus has noted, the OnPostReload trigger along with /r is not recommended, as there is an inherent conflict that occurs, the /r is attempting to shut the reload process down, but the OnPostReload trigger is attempting to run a macro... In addition to what Marcus put out, the other option might be to use a Binary load in a new app with the macro you want to run and us the OnOpen trigger there and put an exit in your macro to close things out, you will need a trigger to fire the other batch process, but that should work consistently I believe.
Regards,
Brett
LOL, and I just realized my logic is flawed here as well, OnOpen is going to run before the Binary load I think, so that may not work, sorry, been a long day, but at least you know why the OnPostReload will not work, hopefully one of Marcus' ideas will pan out.
Regards,
Brett