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
Didn't find your answer? Ask the community — no account required.
C
CS
vConfName as Variant vConfName = swApp.GetConfigurationNames(FileNameandPath)
I use this all the time works great.
P
plh
Tried it. Just what the doctor ordered! Thank You!
-plh
J
Jean Marc BRUN
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 @
"plh" a écrit dans le message de news: snipped-for-privacy@drn.newsguy.com...
P
plh
In article , Jean Marc BRUN says...
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
J
Jean Marc BRUN
Thanks a bunch, I will try to make it run.
"plh" a écrit dans le message de news: snipped-for-privacy@drn.newsguy.com...
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.