Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Design table value through Macro 1

Status
Not open for further replies.

Vinay2479

Mechanical
Aug 16, 2007
18
IN
Hi,

I was trying to edit Design table value through macro.
I used SetEntryValue method under Designtable object.

DT.SetEntryValue(7, 3, False, cellvalue)

* DT is deisgntable object

Its giving me a compile error.
I have written the code as per syntax.
Can anyone help me on this.

Regards,
Vinay
 
Replies continue below

Recommended for you

In VBA you shouldn't use the "(" and ")" symbols in the method if you do not expect the return value.

The following line is correct:

DT.SetEntryValue 7, 3, False, cellvalue

Artem Taturevich, CSWP
Software and Design Engineer
AMCBridge LLC
 
Thanks Artem for reply.
I am not getting compile error now.
But I am not able to edit the designtable with this API.
Follwing is the bit of the code I am using,

DT.EditTable2 (True)
DT.SetEntryValue 49, 3, False, cellvalue
Doc.CloseFamilyTable

Regards,
Vinay
 
Artem's previous statement is also true for your DT.EditTable2 call.

DT.EditTable2 True

You seem to be troubled a bit by VB syntax. It's one of those odd things in VB. If you are requesting a return value, you need parentheses like any other function. If not, no parentheses.

Example:
Code:
retval = DrawingDoc.SetCurrentLayer (layerName)
if you want a return value to report if the operation was successful
Code:
DrawingDoc.SetCurrentLayer layerName
Do this if you want to execute the command without a return value.

re: "void"
The word void by a command in the SW API help indicates that there is no return value, therefore you should not use parentheses to enclose arguments EVER.

[bat]Honesty may be the best policy, but insanity is a better defense.[bat]
-SolidWorks API VB programming help
 
But still I am not able to assign the value to the excel cell of design table.

Regards,
Vinay
 
I get the disconnect from the VBA code after EditTable call? Do you have similar behaviour?

As a workaround you can use diret Excel API for editing the table.

Artem Taturevich, CSWP
Software and Design Engineer
AMCBridge LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top