AnsweredAssumed Answered

Variant Manager Automation Problem

Question asked by mirkobruno on Jun 6, 2019
Latest reply on Jun 6, 2019 by peter_festesen

Hi,

I'm new on DxDesigner Automation. I tried to export Variants from schematic to excel, but I have a problem.

The object VMVariants.Item is always null, though then VMVariants.Count give me the correct number of variant on sch.

 

This is the Visual Basic script :

 

DxDApp = GetObject(, "ViewDraw.Application")

Dim VMaddin As Object = DxDApp.AddIns("Variant Manager")
If IsNothing(VMaddin) Then Exit Sub
VMaddin.Visible = True

Dim vmdoc As Object = VMaddin.Control.VariantGuiApplication.VMDocument
If IsNothing(vmdoc) Then Exit Sub

Dim vmvar As Object = vmdoc.Variants
If IsNothing(vmvar) Then Exit Sub

Dim ivm As Integer = vmvar.Count
Dim idx As Integer = 0
For idx = 1 To ivm
      Dim vmdocitem As Object = vmvar.Item(idx)
      If IsNothing(vmdocitem) Then
         MessageBox.Show("Nothing !")
      Else
         Dim st As String = vmdocitem.Name
      End If
Next

 

Where am I wrong?

Thanks...

Mirko.

Outcomes