This snippet works when using parameters in assembly:
GoExcel.CellValue("My Excel.xlsm", "Sheet1", "D3") = iProperties.Value("Custom", "Number")
But not when the same parameters are in the iProperties in the drawing file. Does anybody know why this does not work for drawings?
Tom
Solved! Go to Solution.
Solved by A.Acheson. Go to Solution.
Solved by tomislav.peran. Go to Solution.
How it "does not work"?
Program crash? Give you wrong info?
Do you want to get the iProperty in drawing?
Or iProperty of the assembly/part in the drawing?
Nothing happens, no errors, unfortunately.
I want to get value from the iProperty in the drawing. The rule is also written in the drawing.
Is the custom iproperty in the drawing?
Isolate the excel portion to check you get the correct value back from the drawing. Try this.
If you get the value then you might have an issue contacting excel. Please attach any error messages your seeing.
MessageBox.Show(iProperties.Value("Custom", "Number"))
Also you mentioned parameters. Parameters work differently in the drawing. For text parameters there is no export option to iproperties at least in the older versions. Can you share a screen shot of the value in parameter window or iproperty window your trying to send to excel.
Hi Acheson,
Thank you for checking my question.
Is the custom iproperty in the drawing?
Yes, the value is in the iproperty of the drawing.
Isolate the Excel portion to check you get the correct value back from the drawing. Try this.
If you get the value then you might have an issue contacting excel. Please attach any error messages your seeing.
MessageBox.Show(iProperties.Value("Custom", "Number"))
That is a good idea. I have tested it and I do get the correct value in the MessageBox.
Also you mentioned parameters. Parameters work differently in the drawing. For text parameters there is no export option to iproperties at least in the older versions. Can you share a screen shot of the value in parameter window or iproperty window your trying to send to excel.
Sure, the value is a number, not a text.
The rule that I want to use to export the value is also in the drawing:
GoExcel.CellValue("MyExcel.xlsm", "Sheet1", "D68") = iProperties.Value("Custom", "VSSPUD_193.7x10x3000")
The Excel sheet is in the same folder as the drawing.
I do not get any errors, just nothing happens.
However, exporting values from assembly works well with the snippet above which makes me wonder if I should use some other snippet in the drawing.
Tom
So, if parameters need to be exported from the drawing then I need to use the following snippets:
GoExcel.Open("MyExcel.xlsm", "Sheet1")
GoExcel.Save
GoExcel.Close
But I do not use those snippets if I export values from assembly.
I am a bit confused about why is that but at least this is solved.
Thanks for the help.
The cellvalue function had its own file open method internally so you shouldn't need the open line before hand but you will need to save,then afterwards close. See Go Excel functions help article here.
Maybe there is an issue getting the excel filename in the drawing folder? You could also use the ilogic path function and concatenate the string path and see does it work better.
Dim fileName As String = ThisDoc.Path & "\MyExcel.xlsm"
Hello,
The cellvalue function had its own file open method internally so you shouldn't need the open line before hand but you will need to save it afterwards close. Go Excel functions
That explains it then. Thanks for the link!
Can't find what you're looking for? Ask the community or share your knowledge.