- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, i create a PDF file from a IDW and i create a excel file and insert the boom from the IDW. Is it possible, i dont know how, to insert the PDF file onto a new worksheet (sheet1)?
Thanks for the help!
Regards Martin
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You can refer to Excel API to do this, below is sample code:
Sub ExcelInsertPDFMacroSample()
Dim oWB As Workbook
Set oWB = Application.ActiveWorkbook
' activate the first work sheet.
oWB.Sheets(1).Activate
' insert the PDF at the A1 cell
Range("A1").Select
' insert as embedded object
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Rocky,
thanks a lot for your reply. Is it possible to get your code as iLogic-code? So i can place it in better.
Regards
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report