AnsweredAssumed Answered

How to set up Events for a DxDesigner Application

Question asked by on Jun 23, 2010
Latest reply on Jun 24, 2010 by



I like to set up a event-handler for a DxDesigner application. But the following code doesn't work and the Dxdesigner crashes during the execution.

It seems that the a Dxdesigner application object has no Active Document?

And the ValidateServer function, which is not shown in my sample code, doesn't work either.

Why do I need the to call this function?


My final goal is to set up a function for the Application_ActivateView() - event.

Maybe someone can give me some hint(s)?


Thanks Joerg



' Add any type libraries to be used.

' Get the Application object
Dim dxdesignerAppObj
Set dxdesignerAppObj = Application

' Get the active document
Dim dxdesignerDocObj
Set dxdesignerDocObj = dxdesignerAppObj.ActiveDocument


' License the document

' ValidateServer(dxdesignerDocObj)


' Attach events from the document object.
Call Scripting.AttachEvents(dxdesignerDocObj, "dxdesignerDocObj")

' Set the Scripting.DontExit property to 
' true to keep the script running.
Scripting.DontExit = True

' Event handlers
' PreClose event handler
Function dxdesignerDocObj_OnPreClose()
    Dim ansEnum
    ansEnum = MsgBox("Close this document?", vbYesNo)
    If ansEnum = vbYesThen
        dxdesignerDocObj_OnPreClose = True
        dxdesignerDocObj_OnPreClose = False