How to obtain config names for unopened files?

Here is what I want to do: Using VB in Excel,
1) Find a directory and obtain a list of the Solidworks files in it - this I can do.
2) Run down the list of files and query the configuration name list for each one(without having to open each one & set a model object) - this I don't know how to do. However, I do have the SW references working in Excel. The question is, does a method exist for doing this.
3) Display the resulting lists in Excel - no problem there.
Does anyone have any suggestions for number 2? Is it possible? Thanx, -plh
--
I keep hitting "Esc" -- but I'm still here!

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
vConfName as Variant vConfName = swApp.GetConfigurationNames(FileNameandPath)
I use this all the time works great.

each
working in

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Tried it. Just what the doctor ordered! Thank You! -plh

--
I keep hitting "Esc" -- but I'm still here!

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I am very much interested by this program.
Is there any way I could have a copy of it?
Thanks in advance
JM Brun
Replace " _arobace/at_ " by @

each
working in

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

It turns out it was not rocket science. This is the code I have in an Excel Spread sheet. Note that I used a literal string for "fs.lookin". Anyone using it would have to change this according to their needs. If you have a lot of files to go through, this thing can take a while. You need to make column B in Excel of type "text" so that you can order by that column & have them come out in a nice logical order, that is, without all the numbers coming first. You also have to add the Sldworks 2004 Type Library in Excel VBA.
Depending on how many files you have, this can take a while to run.
Sub FindConfigs() ' Dim i As Long Dim j As Long Dim k As Long
Dim Begin Dim fs As Object Dim swApp As SldWorks.SldWorks Dim vConfName As Variant Dim strAllFiles() As String Dim strSelFiles() As String Dim lngConfigCount As Long Set swApp = CreateObject("SldWorks.Application") ReDim strAllFiles(256) Set fs = Application.FileSearch With fs .LookIn = "N:\ENGINEERING\00 - VAULT\Solidworks Files\" .SearchSubFolders = True .Filename = "*.sldprt;*.sldasm;*.prt;*.asm" If .Execute() > 0 Then For i = 1 To .FoundFiles.Count If i > UBound(strAllFiles) Then ReDim Preserve strAllFiles(UBound(strAllFiles) + 256) End If strAllFiles(i) = .FoundFiles(i) Next i Else MsgBox "There were no files found." End If End With j = 1 For i = 1 To UBound(strAllFiles) Debug.Print strAllFiles(i) If InStr(strAllFiles(i), "~$") = 0 Then 'excludes "those" files ReDim Preserve strSelFiles(j) strSelFiles(j) = strAllFiles(i) j = j + 1 End If Next i k = 2 'leaves the 1st row empty for titles in Excel Spreadsheet For i = 1 To UBound(strSelFiles) lngConfigCount = swApp.GetConfigurationCount(strSelFiles(i)) If lngConfigCount > 1 Then 'ignore files with only one configuration vConfName = swApp.GetConfigurationNames(strSelFiles(i)) For j = 0 To UBound(vConfName) If vConfName(j) <> "Default" Then 'don't list "Default" configurations Range("A" & k).Value = strSelFiles(i) Range("B" & k).Value = vConfName(j) k = k + 1 End If Next j End If Next i End Sub
-plh

--
I keep hitting "Esc" -- but I'm still here!

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks a bunch, I will try to make it run.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.