Ilogic write Custom Table to Excel

Ilogic write Custom Table to Excel

Chirpyboy2060647
Advocate Advocate
509 Views
3 Replies
Message 1 of 4

Ilogic write Custom Table to Excel

Chirpyboy2060647
Advocate
Advocate

So im trying to add to my ilogic code to bring in the Custom Table that I have in my drawing over with the rest thats going to excel. Ive been looking around a lot and just cant seem to figure it out. I know there is no actual iLogic button for this and would need to create a code for this to work, well at least from what I've seen at different posts. Also if it helps im in 2015

 

But i just dont know what to make to have it work with my code.

 

ExcelFile =  "\\Fig015\cad\0-File Transfer\Brian Maciejewski\Test" & ".xlsx"
' get the path and name of the drawing file


' access the Rows and Custom properties on the table object
 


'GoExcel.CellValue(ExcelFile, "Sheet1", "A1") = ("Date")'GoExcel.CellValue(ExcelFile, "Sheet1", "B1") = ("Team")'GoExcel.CellValue(ExcelFile, "Sheet1", "C1") = ("Project Number")'GoExcel.CellValue(ExcelFile, "Sheet1", "D1") = ("Project Name")'GoExcel.CellValue(ExcelFile, "Sheet1", "E1") = ("Description")'GoExcel.CellValue(ExcelFile, "Sheet1", "F1") = ("Fabric")

GoExcel.CellValue(ExcelFile, "Sheet1", "D2")  = iProperties.Value("Custom","FI_001") 'Date Drawn
GoExcel.CellValue(ExcelFile, "Sheet1", "B2") = iProperties.Value("Custom", "FI_002") 'Proj Manager GoExcel.CellValue(ExcelFile, "Sheet1", "C2") = iProperties.Value("Custom", "FI_005") 'Drawing Number GoExcel.CellValue(ExcelFile, "Sheet1", "K1") = iProperties.Value("Custom", "FI_007") 'Proj Name GoExcel.CellValue(ExcelFile, "Sheet1", "E2") = iProperties.Value("Custom", "FI_004") GoExcel.CellValue(ExcelFile, "Sheet1", "F3") = iProperties.Value("Custom", "FI_010") 'Fabric Application GoExcel.CellValue(ExcelFile, "Sheet1", "F2") = iProperties.Value("Custom", "FI_011") 'Fabric Type GoExcel.CellValue(ExcelFile, "Sheet1", "D2") = iProperties.Value("Custom", "FI_012") 'Sleeve Placement GoExcel.CellValue(ExcelFile, "Sheet1", "D3") = iProperties.Value("Custom", "FI_013") 'Velcro Location GoExcel.CellValue(ExcelFile, "Sheet1", "D4") = iProperties.Value("Custom", "FI_014") 'Zipper Location GoExcel.CellValue(ExcelFile, "Sheet1", "K2") = iProperties.Value("Custom", "FI_103") 'Order Numb GoExcel.CellValue(ExcelFile, "Sheet1", "D1") = iProperties.Value("Custom", "FI_006") 'Client Name GoExcel.CellValue(ExcelFile, "Sheet1", "M10") = iProperties.Value("Custom", "FI_025") 'Sleeve GoExcel.CellValue(ExcelFile, "Sheet1", "M11") = iProperties.Value("Custom", "FI_042") 'Insert GoExcel.CellValue(ExcelFile, "Sheet1", "M12") = iProperties.Value("Custom", "FI_044") 'Eyebolt

 

0 Likes
510 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor

Here is a sample you can work off of:

 

Sub Main()
Dim oUser As String
Dim oRevNote As String
Dim oPath As String
Dim oWO As String
Dim Loc As String

oUser = ThisApplication.GeneralOptions.UserName
oRevNote = InputBox("What did you change?", "REV", "")
oPath = ThisApplication.ActiveDocument.FullFileName
oWO = ThisApplication.ActiveDocument.PropertySets.Item("Inventor User Defined Properties").Item("WO#").Value	

If oRevNote = ""
	Exit Sub
End If

Loc = "C:\Documents\Excel File Log"
WorkSheet = Loc
Sheetno = ("Sheet1")
' Open excel 
GoExcel.Open(WorkSheet, Sheetno)
' Define Range
oRowStart = 2
oRowEnd = 100
For count = oRowStart To oRowEnd
	' If it's blank count it
	If String.IsNullOrEmpty(GoExcel.CellValue("A" & count)) Then 
		i = i + 1
	End If
Next
' Next empty oRow is max oRows minus blank oRows plus one
oRow = oRowEnd - i + 1
GoExcel.CellValue("A" & oRow) = TimeString
GoExcel.CellValue("B" & oRow) = DateString
GoExcel.CellValue("C" & oRow) = oUser
GoExcel.CellValue("D" & oRow) = oRevNote
GoExcel.CellValue("E" & oRow) = oWO
GoExcel.CellValue("F" & oRow) = oPath
GoExcel.Save

'newExcelApp = CreateObject("Excel.Application")
'newExcelApp.Visible = True
'newExcelApp.Workbooks.Open(Loc)
GoExcel.Close
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 4

Chirpyboy2060647
Advocate
Advocate

Well Thanks for replying with a suggestion but I dont know if that is something i could work off of. I uploaded an image of what table im trying to bring to excel. Now these arent parts that are actually in my drawing, as they are added through a macro that was already created in VBA.

0 Likes
Message 4 of 4

Chirpyboy2060647
Advocate
Advocate
Figured it out. Was a line of code that was messing me up.
0 Likes