Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Alphabetize configlist in SolidWorks

Status
Not open for further replies.

mechanate

Mechanical
Mar 18, 2010
16
0
0
US
Hey guys, this is spun off another thread that I started over in the SolidWorks forum, though I'm not sure this is the exact correct place to ask this question. I'm currently developing a macro within SolidWorks and have run into a slight irritant. It seems that SolidWorks orders configuration numbers based on when they were created, not what order they appear in within the program. Anyway, I'm retrieving the list of configurations within SolidWorks with the following little bit of code

Code:
ConfigList = swDoc.GetConfigurationNames()

This places a list of strings within ConfigList, each one being the name of a configuration. This is done so I can later reference these names and attach them to a page in a GUI. These names are retrieved based on the order they were created though. Is there a way to take this list and then alphabetize the string array so that they appear in alphabetical order? I want to alphabetize it so that the correct name shows up on the correct page number according to the order SolidWorks shows the configurations. Pardon me if this is a little confusing, I'm still rather new to this whole VBA and object oriented language thing.
 
Replies continue below

Recommended for you

If the version of VBA is newer, you can use the built in sort method.
Code:
ConfigList.Sort(ConfigList)

If the version of VBA does not support this method, you will have to write your own code to sort. A web search on the term "sort array VBA" will return thousands of webpages that can give detailed instructions and code.
 
Status
Not open for further replies.
Back
Top