External rules will not run after saving the drawing as another

External rules will not run after saving the drawing as another

865966724
Contributor Contributor
250 Views
2 Replies
Message 1 of 3

External rules will not run after saving the drawing as another

865966724
Contributor
Contributor

 

Dim GoExcel As Object
Dim xlWorkbook As Object = Nothing
Dim xlWorksheet As Object = Nothing
Dim i As Integer = 1
Dim doc As Document


GoExcel = CreateObject("Excel.Application")
Dim sPathExcel As String = "C:\Users\technical\Desktop\test\test.xlsx"
Dim outputPath As String

GoExcel.Visible = False
xlWorkbook = GoExcel.Workbooks.Open(sPathExcel)
xlWorksheet = xlWorkbook.Worksheets("Sheet1")

Do
    If xlWorksheet.Cells(i, 1).Value2 Is Nothing OrElse String.IsNullOrEmpty(xlWorksheet.Cells(i, 1).Value2.ToString()) Then
        Exit Do
    End If
    componentName = xlWorksheet.Cells(i, 1).Value2.ToString()
    outputPath ="C:\Users\technical\Desktop\test\" & componentName & ".idw"
    ThisDoc.Document.SaveAs(outputPath, True)
	iLogicVb.RunExternalRule("test")

    i += 1
Loop

If xlWorkbook IsNot Nothing Then
    xlWorkbook.Close(False)
    System.Runtime.InteropServices.Marshal.ReleaseComObject(xlWorksheet)
    System.Runtime.InteropServices.Marshal.ReleaseComObject(xlWorkbook)
End If
If GoExcel IsNot Nothing Then
    GoExcel.Quit()
    System.Runtime.InteropServices.Marshal.ReleaseComObject(GoExcel)
End If

 

I have a piece of code where the saved part works normally after I run it, but the part that runs external rules does not work. I don't know why. Can someone help me.The attachment is my test file.🤔

0 Likes
251 Views
2 Replies
Replies (2)
Message 2 of 3

m_baczewski
Advocate
Advocate

Did you do that?

m_baczewski_0-1692871607168.png

 

 

0 Likes
Message 3 of 3

865966724
Contributor
Contributor

Yes, thank you very much. This was successful, but I still have a question. Can I rely solely on code to complete this task? Perhaps my understanding is questionable.

0 Likes