×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Setting Design table value through Macro

Setting Design table value through Macro

Setting Design table value through Macro

(OP)
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

RE: Setting Design table value through Macro

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
www.amcbridge.com

RE: Setting Design table value through Macro

(OP)
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
 

RE: Setting Design table value through Macro

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.

batHonesty may be the best policy, but insanity is a better defense.bat
http://www.EsoxRepublic.com-SolidWorks API VB programming help

RE: Setting Design table value through Macro

(OP)
But still I am not able to assign the value to the excel cell of design table.

Regards,
Vinay

RE: Setting Design table value through Macro

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
www.amcbridge.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources