Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
YuhanZhang
in reply to: martinhoos

I am not sure how iLogic can reference to Excel API in iLogic rule, but below is a sample for you to call Excel API via Inventor VBA Editor, you can add the reference(Tools->References...) to "Microsoft Excel xx.0 Object Library" in VBA Editor, the xx is the version of the Excel, and then in Inventor VBA run below macro:

 

Sub InsertPDFSample()
    Dim oExcel As Excel.Application

    On Error Resume Next
    Set oExcel = GetObject(, "excel.application")
    
    If Err.Number <> 0 Then
        Set oExcel = CreateObject("excel.application")
    End If
    
    oExcel.Visible = True
    
    Dim sExcelPath As String
    sExcelPath = "C:\TEMP\Test.xlsx"
    
    Dim oWorkbook As Excel.Workbook
    Set oWorkbook = oExcel.Workbooks.Open(sExcelPath)
    
    ' activate the first work sheet.
    oWorkbook.Sheets(1).Activate
    
    ' insert the PDF at the A1 cell
    oWorkbook.Sheets(1).Range("A1").Select

    ' insert as embedded object
    oWorkbook.ActiveSheet.OLEObjects.Add(FileName:="C:\Temp\MyPDF.pdf" _
        , Link:=False, DisplayAsIcon:=False).Select
    
    ' insert as linked object
    'ActiveSheet.OLEObjects.Add(Filename:="C:\Temp\MyPDF.pdf" _
        , Link:=True, DisplayAsIcon:=False).Select
End Sub


If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.