1 of 1 people found this helpful
You don't need to call ValidateServer, this is a wrapper function around the Expedition automation licensing, which is not required for DxDesigner.
Also, you do not need to call Scripting.AddTypeLibrary if the script is running in DxDesigner, the type library is loaded automatically. You only need to call AddTypeLibrary if the script is hosted by a different application, like Expedition or mgcscript.
Likewise, when the script is run in DxDesigner, there is an implicit call to AttachEvents for the Application object. Since you want to handle the Application_ActivateView event, just declare a function named Application_ActivateView that takes no arguments. You will notice in the DxDesigner Automation manual, it is recommended to use the ActivateView2 event instead, because of a timing problem. To follow that recommendation, declare a function named Application_ActivateView2 that takes one argument, the active view:
MsgBox "View " & v.Block.GetName(0) & " activated"
You can remove the active document code, it appear this code was copied from an Expedition script, since there is no OnPreClose event for DxDesigner.
Now it works! That was a "push" in the right direction
Thanks for your fast help.