Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to export few iProperties into Excel but on this line shows me error
SyntaxEditor Code Snippet
Dim Names={"Display name", "Title", "Part Number", "Date", "Revision"}
Array initializers are valid only for arrays, but the type of 'Names' is 'Object'
Can you guys guide me in right direction, please.
'Try the following rule to debug the export of your iProperties to the Excel workbook. 'It assumes that the active document is an assembly 'open the existing excel file GoExcel.Open("c:\TEMP\EXPORT.xlsx", "Sheet1") 'Print column titles in the row 2 Dim Names={"Display name", "Title", "Part Number", "Date", "Revision"} GoExcel.CellValues("A2", "E2") = Names Dim oAsmDoc As AssemblyDocument = TryCast(ThisApplication.ActiveDocument,AssemblyDocument) If oAsmDoc Is Nothing Then MessageBox.Show("Activate assembly document first", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Information) Exit Sub End If Dim Data(4) As String 'string array for properties Dim row As Integer = 3 'start data row Dim oPropSet As PropertySet Dim oProp As Inventor.Property For Each oDoc As Inventor.Document In oAsmDoc.AllReferencedDocuments 'full filename Data(0) = oDoc.FullFileName 'Title oPropSet = oDoc.PropertySets.Item("Inventor Summary Information") oProp = oPropSet.Item("Title") Data(1) = oProp.Value 'Part Number oPropSet = oDoc.PropertySets.Item("Design Tracking Properties") oProp = oPropSet.Item("Part Number") Data(2) = oProp.Value 'Date oPropSet = oDoc.PropertySets.Item("Design Tracking Properties") oProp = oPropSet.Item("Creation Time") Data(3) = oProp.Value 'Revision oPropSet = oDoc.PropertySets.Item("Inventor Summary Information") oProp = oPropSet.Item("Revision Number") Data(4) = oProp.Value GoExcel.CellValues("A" & CStr(row), "E" & CStr(row)) = Data row += 1 Next GoExcel.Save GoExcel.Close MessageBox.Show("Done", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Information)
Here is whole code i found i beleive in this forum. Thanks for help
Solved! Go to Solution.