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!

*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.

Jobs

Design Tables and VBA code

Design Tables and VBA code

(OP)
So when did Solidworks Design Tables stop allowing VBA code within the Design Table? Years ago I used to be able to write full programs within SW Design Tables and now after building my new Toolbox files the Design Tables always removes the VBA code after I close the Design table in the part file? Such Bologna! Any one seen this or know of a different solution. Equations won't do what I want to do.

Scott Baugh, CSWP pc2
CAD Systems Manager
Evapar

www.evapar.com

Quote:

"If it's not broke, Don't fix it!"
FAQ731-376: Eng-Tips.com Forum Policies

RE: Design Tables and VBA code

My first guess (not having looked into it at all yet) would be that maybe it's more related to Excel than SW? What version of Excel are you using? Ye olde versions didn't have a distinction between macro-enabled and standard workbooks, but new versions have to use the .xlsm or whatever format. Maybe if you could save as old format excel it'd work?

-handleman, CSWP (The new, easy test)

RE: Design Tables and VBA code

Seems to work for me... Probably what you have to do is create a template in Excel for the DT and save it as .xlsm. Then use that template to create your DT in SW. This is similar to Excel behavior... If you take a .xlsx file and add VBA code, the code will be stripped out when you save, unless you Save As .xlsm. Since SW saves the Excel sheet as an OLE, it doesn't give you the opportunity to Save As.

-handleman, CSWP (The new, easy test)

RE: Design Tables and VBA code

(OP)
Sorry was on vacation after I posted this.

I am using office 2013.

I am glad you found the solution. How to I go about saving a template that supports macros\vba, then force SW to use that template?

When I look at the save as template in excel its just an *.xltx, it doesn't give descriptive information as to whether or not it supports macros\vba. Nevermind I found the correct template... my bad I looked right over it. The Auto-create DT doesn't have a direct way to forcefully use a specific template. Browsing for a pre-made DT is not something I want to do, because it has to be made in laid out in a different way (at least it used to be that away).

Scott Baugh, CSWP pc2
CAD Systems Manager
Evapar

www.evapar.com

Quote:

"If it's not broke, Don't fix it!"
FAQ731-376: Eng-Tips.com Forum Policies

RE: Design Tables and VBA code

(OP)
Found this at the SW customer Portal = 1-15006111116 Voted For : Customer is requesting a design table file location.

Explanation:I want to be able to load a Macro enabled Excel template. Due to this limitation I cannot create macros or add VBA inside Design tables anymore. Prior to Excel making two different file types for Macro enabled and regular Excel files adding VBA to a Design Table was possible now its not and its a limitation... IMO its more of a regression, because this was available.

Scott Baugh, CSWP pc2
CAD Systems Manager
Evapar

www.evapar.com

Quote:

"If it's not broke, Don't fix it!"
FAQ731-376: Eng-Tips.com Forum Policies

RE: Design Tables and VBA code

(OP)
I think I found a way around it, I think.

Add a default Design Table, save the DT as an Enabled macro table. Delete the table in the file. Insert a new DT and browse for the one I just made.

That seemed to work, but I have not tested it after its checked into the vault yet. Real PITB... would be easier if I could load a template from within SW instead.

Scott Baugh, CSWP pc2
CAD Systems Manager
Evapar

www.evapar.com

Quote:

"If it's not broke, Don't fix it!"
FAQ731-376: Eng-Tips.com Forum Policies

RE: Design Tables and VBA code

Scott,

Why is it you don't want to start from a file? Is it so that AutoCreate pulls in all the params for you?

-handleman, CSWP (The new, easy test)

RE: Design Tables and VBA code

(OP)
When you "Auto Create" a DT you have an information Cell, then the Parameter Cell, then the Value cell. That is a standard DT.



In previous versions of SW, when you browse for a DT you did not get an information cell only the Parameter and a Value Cell. The information cell is vital to knowing what the parameters are.



The images above shows where I have tried browsing for a DT and this occurs. You cannot add the information cell into either before or after because its not recognized. I asked about this back in 2001-2002 and Support said that is just the way it is.

The other reason is I don't want to have an externally linked table. I want all my DT embedded in the file. I know there is an option not to select and this works fine if its just me doing all of the work.

Yesterday when I made the DT from Auto Create, saved it, deleted the DT, re-added it and browsed to the one I just saved. That worked with the information cell, but I only tried it one time. I have not had a chance to test this further.

Scott Baugh, CSWP pc2
CAD Systems Manager
Evapar

www.evapar.com

Quote:

"If it's not broke, Don't fix it!"
FAQ731-376: Eng-Tips.com Forum Policies

RE: Design Tables and VBA code

2
Sorry your support is incompetent...

Just take your working, autocreated DT that you saved out, delete the params and config names, and then you can re-use it as a blank.

Or, just FYI, the key thing that tells SW where to start the DT is a cell named "Family". If you'll notice when you select cell A2 of an auto-create DT, the cell name is "Family" in the little top left corner box. You can name whatever cell you want in column A (or maybe any column, not sure) "Family" and that will be the corner of the DT.

-handleman, CSWP (The new, easy test)

RE: Design Tables and VBA code

(OP)
Yeah they are not the best... I was sorry to see 3DVision sell out to them.

"Re-use as a blank" - That's is good idea, never thought about that, Thanks!

Really "Family" I never noticed that. So I can change the named cell to another cell and that is where the DT will start? That's awesome, because that would allow me to make my programming parameters above the DT.

Scott Baugh, CSWP pc2
CAD Systems Manager
Evapar

www.evapar.com

Quote:

"If it's not broke, Don't fix it!"
FAQ731-376: Eng-Tips.com Forum Policies

RE: Design Tables and VBA code

(OP)
I finally sat down this morning and tried your suggestions. It worked great! Telling us about the "FAMILY" cell is topping on the cake! Now I can move my programming layout to the top of the DT instead of surfing all around to find it. AWESOME thank you Handleman!

Scott Baugh, CSWP pc2
CAD Systems Manager
Evapar

www.evapar.com

Quote:

"If it's not broke, Don't fix it!"
FAQ731-376: Eng-Tips.com Forum Policies

RE: Design Tables and VBA code

Yeah, the Help file could probably use some improvement... The topic for "Formatting Automatically Created Design Tables" talks about the "Family" cell, but the manual topic doesn't. In fact, it specifically says that A1 has to be the corner of the table. I'm not sure if they thought that explaining to people how to name a cell "Family" was too hard to explain in the help file?

Anyway, glad you got it to work!

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


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close