Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Design Tables and VBA code 2

Status
Not open for further replies.

SBaugh

Mechanical
Mar 6, 2001
6,685
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

"If it's not broke, Don't fix it!"
faq731-376
 
Replies continue below

Recommended for you

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

"If it's not broke, Don't fix it!"
faq731-376
 
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

"If it's not broke, Don't fix it!"
faq731-376
 
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

"If it's not broke, Don't fix it!"
faq731-376
 
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)
 
When you "Auto Create" a DT you have an information Cell, then the Parameter Cell, then the Value cell. That is a standard DT.

DT_1_y3de8r.jpg


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.

DT_2_mzjcrh.jpg


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

"If it's not broke, Don't fix it!"
faq731-376
 
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)
 
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

"If it's not broke, Don't fix it!"
faq731-376
 
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!

DT_3_wfntet.jpg


Scott Baugh, CSWP [pc2]
CAD Systems Manager
Evapar

"If it's not broke, Don't fix it!"
faq731-376
 
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!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor