Macro and ilogic form not cooperating

Macro and ilogic form not cooperating

Anonymous
Not applicable
625 Views
1 Reply
Message 1 of 2

Macro and ilogic form not cooperating

Anonymous
Not applicable

I have a macro that opens an iLogic form. The form is for updating custom iProperties in the title blocks of drawings (so all pages have the information in the title block.) Rule0, which calls the form, is also called when the document is created. When I run the macro is works fine until "iLogicAuto.RunRuleDirect." A box for the form pops up with nothing inside it, then freezes and inventor crashes.

 

Here is the macro code:

Sub EditProperties()
Dim pDoc As Document

'Get iLogic addins
Dim addIn As ApplicationAddIn
Dim addIns As ApplicationAddIns
Set addIns = ThisApplication.ApplicationAddIns
For Each addIn In addIns
   If InStr(addIn.DisplayName, "iLogic") > 0 Then
      addIn.Activate
      Dim iLogicAuto As Object
      Set iLogicAuto = addIn.Automation
   End If
Next
Set pDoc = ThisApplication.ActiveDocument

Dim rules As Object
Set rules = iLogicAuto.rules(pDoc)
If Not (rules Is Nothing) Then
   For Each rule In rules
      If (rule.Name = "Rule0") Then
         iLogicAuto.RunRuleDirect (rule)
      End If
   Next
End If
End Sub

Thanks in advance for any help.

0 Likes
Accepted solutions (1)
626 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

Okay, I fixed it myself. Now I have a VBA form that gets called from a rule when a new document opens, and can also be called from a macro button.

0 Likes