Set DXDApp = GetObject(, "viewdraw.Application")
Set VMaddin = DXDApp.AddIns("Variant Manager")
If VMaddin Is Nothing Then
invokeVM
Else
VMaddin.visible = True
End If
Set vmdoc = VMaddin.Control.VariantGuiApplication.VMDocument
Set vmvar = vmdoc.Variants
Debug.Print vmvar.Count
Private Function invokeVM() As Boolean
Set VMaddin = DXDApp.AddIns.Add("MGCVARIANTGUI.MGCVariantGUICtrl.1", "Variant Manager", associatedScript)
If VMaddin Is Nothing Then
invokeVM = False
MsgBox "not possible to start Variant Manager; Please start it manually", vbCritical
Else
invokeVM = True
VMaddin.visible = True
End If
End Function