Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
I have an OnActivateSheet trigger which is comprised of 2 actions.
First Action is "Clear All" which works OK.
2nd Action calls for a Run Macro.
The code behind the macro (VBScript) is simple. Here it is:
Sub SelectCurrentYear()
ActiveDocument.Fields("YR").Select Year(now())
End sub
When running the macro from the Edit Module it performs correctly however does not run from the trigger.
(The same macro is being called from various buttons and performs correctly when they are pressed.)
Any idea why?
Thanks
Josh
Hello,
Why are you using a macro ?
You can use the action : 'Select in field' with YR = Year(now())
Thank you Blond
Actually my example was simplified and was to bring a point that a Macro is not triggered in OnActivateSheet.
The actual actionthat I use invokes a macro that selects the last 12 (or 24 or 36) running consecutive months.
I am not sure that this can be achived using Select in Field. (If it is possible, I would like to know how)
I have a VB function, that based on a parameter (12, 24 or 36) selects the number months. But as mentioned it does not work from the trigger but does work when run manuall or from a button.
Hi,
I hope the qvw attached will help you.
I create a key field in my calendar which is Year*12 + Month, i also created a variable containing the number of running consecutive months to select.
The trigger i created is then based on this field. I didn't use any macros.
merci beaucoup Blond
Merci beaucoup Marie-Sophie 😉