EXPORTING I-PROPERTIES TO AN EXCEL SPREADSHEET

EXPORTING I-PROPERTIES TO AN EXCEL SPREADSHEET

Anonymous
Not applicable
1,610 Views
4 Replies
Message 1 of 5

EXPORTING I-PROPERTIES TO AN EXCEL SPREADSHEET

Anonymous
Not applicable

Hello Everyone,

 

Here is my issue. I need to export certain I-properties from my Inventor dwg and the Assembly that is on it and the parts that build it to an excel to very particular cells in an Excel Spreadsheet. I know that there are some similar VBA codes out there that do something of the sorts, but i'm brand spanking new to VBA. My company has been looking into links from inventor to an ERP program but to no satisfying solution. Can anyone help with the code I need to do what i need to do? If you need more information please let me know.

0 Likes
Accepted solutions (1)
1,611 Views
4 Replies
Replies (4)
Message 2 of 5

MechMachineMan
Advisor
Advisor
GoExcel.CellValue("A" & 1) = iProperties.Value("Custom", "WO#") & " - " & iProperties.Value("Summary","Title") & " - " &iProperties.Value("Summary","Subject")

 the code above can be used at almost any point within:

 

Dim Loc as String = "C:\Loaction\File.xslx"

Dim excelApp As Object 
Try 
    excelApp = GetObject(, "Excel.Application")
    For Each wb As Object In excelApp.workbooks
       If UCase(wb.fullname) = UCase(filename) Then
	   'workbook is already opened: Save and close it
	   wb.Save
	   wb.Close   
	   Exit For
        End If
    Next
Catch
Finally
    excelApp = Nothing
End Try


Worksheet = Loc
Sheetno = ("Sheet1")
' Open excel 


Try
GoExcel.Open(Worksheet, Sheetno)
Catch
	MsgBox("Sheet Location Not Valid, or Cancel Was Used.",,"RULE UPDATE")
	Exit Sub
End Try


If String.IsNullOrEmpty(GoExcel.CellValue("A" & 1)) Then
	GoExcel.CellValue("A" & 1) = iProperties.Value("Custom", "WO#") & " - " & iProperties.Value("Summary","Title") & " - " &iProperties.Value("Summary","Subject")

End If ' Define Range RowStart = 3 RowEnd = 2000 For count = RowStart To RowEnd ' If it's blank count it If String.IsNullOrEmpty(GoExcel.CellValue("A" & count)) Then i = i + 1 End If Next ' Next empty row is max rows minus blank rows plus one rowe = RowEnd - i + 1

'Put your iterated row operations here if needed


GoExcel.Save
GoExcel.Close
newExcelApp = CreateObject("Excel.Application")
newExcelApp.Visible = True
newExcelApp.Workbooks.Open(Loc)

'MsgBox("FILE IS UPDATED")

End Sub

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 5

Anonymous
Not applicable

Thank you for the quick response. I will most defendantly try this. will this code work from the dwg file and dive into the model and parts? I 'm trying to keep from have two codes to pull everything i need. I want to be able to have the dwg file open and connect to the model associated with it.

0 Likes
Message 4 of 5

MechMachineMan
Advisor
Advisor

Yes, this will work from the idw's,

 

As it is, the files are all actually loaded into memory (even when you load an idw without any iLogic to open things).


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 5 of 5

Anonymous
Not applicable
Accepted solution

To explain what i had to do to solve this,

I pushed the i-properties that i needed to export from the assembly to the drawing itself through i-logic and then from there i exported them to excel.

0 Likes