iParts not exporting to Excel... but iAssy works

iParts not exporting to Excel... but iAssy works

danny.lewisA9QBW
Advocate Advocate
580 Views
4 Replies
Message 1 of 5

iParts not exporting to Excel... but iAssy works

danny.lewisA9QBW
Advocate
Advocate

So I can't figure why the command is working or assembly iAssy but not for the part iPart. Below is the chunk of code to run them. I've attached example files I was using.

Error Messages1.JPGError Messages2.JPG

Dim Path As String = "C:\TEST\ExportTest"
Dim ExportFile As String = Path & ".xls"

Logger.Info("ExportFile " & ExportFile)
Dim oDoc As Document = ThisDoc.Document

If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Logger.Info("Assy FileType")	
	Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument


	If oAsmDoc.ComponentDefinition.IsiAssemblyFactory = True Then
		Logger.Info("Assy iAssemblyFactory Found")
		Dim oiAssyFactory As iAssemblyFactory = oAsmDoc.ComponentDefinition.iAssemblyFactory
		oiAssyFactory.Export(ExportFile, FileFormatEnum.kMicrosoftExcelFormat)
	End If
End If

If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
Logger.Info("Part FileType")
	Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
Logger.Info("oPartDoc")
	If oPartDoc.ComponentDefinition.IsiPartFactory = True Then		
		Logger.Info("Part iPartFactory Found")
		Dim oiPartFactory As iPartFactory = oPartDoc.ComponentDefinition.iPartFactory
		oiPartFactory.Export(ExportFile, FileFormatEnum.kMicrosoftExcelFormat)
	End If
End If

 

 

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

bradeneuropeArthur
Mentor
Mentor
Dim Path As String = "C:\TEST\ExportTest"
Dim ExportFile As String = Path & ".xlsx"

Logger.Info("ExportFile " & ExportFile)
Dim oDoc As Document = ThisDoc.Document

If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Logger.Info("Assy FileType")	
	Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument


	If oAsmDoc.ComponentDefinition.IsiAssemblyFactory = True Then
		Logger.Info("Assy iAssemblyFactory Found")
		Dim oiAssyFactory As iAssemblyFactory = oAsmDoc.ComponentDefinition.iAssemblyFactory
		oiAssyFactory.Export(ExportFile, FileFormatEnum.kMicrosoftExcelFormat)
	End If
End If

If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
Logger.Info("Part FileType")
	Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
Logger.Info("oPartDoc")
	If oPartDoc.ComponentDefinition.IsiPartFactory = True Then		
		Logger.Info("Part iPartFactory Found")
		Dim oiPartFactory As iPartFactory = oPartDoc.ComponentDefinition.iPartFactory
		oiPartFactory.Export(ExportFile, FileFormatEnum.kMicrosoftExcelFormat)
	End If
End If

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 5

bradeneuropeArthur
Mentor
Mentor
Accepted solution

use "xlsx" instead of "xls"

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 5

danny.lewisA9QBW
Advocate
Advocate

@bradeneuropeArthur 

 

so that works.... but WTF...

 

why is it .xls for Assemblies (and .xlsx doesn't work) and .xlsx for Parts (And .xls doesn't work)?

 

Regardless the why... it's working; I'll take it. 🙂

Message 5 of 5

bradeneuropeArthur
Mentor
Mentor

That is indeed strange!

@johnsonshiue Do you have any idea why that is the case!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes