Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I'm very new to macros but have created one in where when a sheet is selected a certain field is automatically selected:
ActiveDocument.Fields("Active").Select ActiveDocument.Evaluate("Active")
However, I want to create a similar macro that when I leave the sheet the field selection is removed. I know how to do this but it won't seem to let me create the second macro for some reason? Anyone know why?
Thanks,
What do you mean by, "won't seem to let me create the second macro?" Are you able to create a different Sub to handle the OnLeaveSheet?
What are you using to Deselect the field? You could use ToggleSelect (instead of Select). If that field is Selected, it will then unselect it (but if the field is not selected, it will select it). You could also clear that field, but that will clear everything.
I'm going to sheet properties on the relecant sheet and then macros. I have one macro on the OnActivateSheet Trigger. I then try to create a different one on the OnLeaveSheet trigger, but when I do this it ends up editing my initial (OnActivateSheet) macro. Any ideas why this would be the case?
I would like my leaving the sheet macro to be:
Sub ClearField
ActiveDocument.fields(Active).Clear
End Sub
What I want is one macro for when I click on this sheet and a separate macro so that then I leave the sheet the field is deactivated.
I would appreciate any help.
Hi everyone,
Apologies - I thought a new module window was needed for each macro! My mistake. Got it working now. Thanks
Just curious why did you use macro to select / unselect a field value and why not set actions on the sheet itself. (Sheet Properties >> Actions >> Action Type >> Selection)
I'm still using version 8.5