Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ilogic Create Parameter from Excel cell Value

0 REPLIES 0
Reply
Message 1 of 1
Amit_11
815 Views, 0 Replies

Ilogic Create Parameter from Excel cell Value

I am new to Ilogic and trying to write a  Code, where I am looking for a cell value in Excel Sheet, then trying to use that value to create Inventor Parameter. The code I am trying to use is as follows;

 

Format:HTML Format
Version:1.0
StartHTML: 165
EndHTML: 16704
StartFragment: 314
EndFragment: 16672
StartSelection: 314
EndSelection: 314

SyntaxEditor Code Snippet

ImportsInventor.UnitsTypeEnum

oDoc=ThisApplication.ActiveDocument
oDocParameters=oDoc.ComponentDefinition.Parameters.UserParameters
oFactory=ThisApplication.ActiveDocument
oFactPath=ThisDoc.Path
oFactName=ThisDoc.FileName(False)'without extension
oFactNameFull=ThisDoc.PathAndFileName(True)
oMemberPath=oFactPath&"\"&oFactName&"\"
DimoFactoryExtAsString
IfoFactory.DocumentType=kPartDocumentObjectThen
oFactoryExt=".ipt"
ElseIfoFactory.DocumentType=kAssemblyDocumentObjectThen
oFactoryExt=".iam"
ElseIfoFactory.DocumentType=kDrawingDocumentObjectThen
oFactoryExt=".idw"
EndIf

DimFeatNameAsString
DimColNameAsString


oFactTable2=oFactPath&"\"&oFactName&"\Parameter.xlsx"

GoExcel.TitleRow=1
RowStart=2
RowEnd=100
ForRowNumber=RowStartToRowEnd

IfVal(GoExcel.CellValue(oFactTable2,"Sheet1","A"&RowNumber))<>0Then
NoRow=NoRow+1

FeatName=GoExcel.CellValue(oFactTable2,"Sheet1","B"&RowNumber)
ColName=GoExcel.CellValue(oFactTable2,"Sheet1","B"&RowNumber)

Try
Param=oDocParameters(FeatName)
Catch
oParameter=oDocParameters.AddByValue(FeatName, Test, kTextUnits)
EndTry

ExitFor
EndIf
Next

I am getting following error:

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

 

Need Help. Please respond.

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report