Hi,
Forgive me if this is the wrong place for this request, also pleasebe gentle as this is the first time I have gotten involved in"coding" anything ever!
I've hacked about someone elses macro to take the filename and addit as a custom property, this works fine.
I would like to be able to run this macro and run it on all thefiles in a folder. We currently have thousands of parts anddrawings and I am trying to automate the renaming of them all tounique numbers prior to implementing PDMworks in early June.
So the simple question is this, is it possible to run a macro onall the files in a folder? If it is how do I do it? (even if Icould be pointed in the right direction that would be appreciated)
Many thanks,
Mike
SolidworksApi macros
Forgive me if this is the wrong place for this request, also pleasebe gentle as this is the first time I have gotten involved in"coding" anything ever!
I've hacked about someone elses macro to take the filename and addit as a custom property, this works fine.
I would like to be able to run this macro and run it on all thefiles in a folder. We currently have thousands of parts anddrawings and I am trying to automate the renaming of them all tounique numbers prior to implementing PDMworks in early June.
So the simple question is this, is it possible to run a macro onall the files in a folder? If it is how do I do it? (even if Icould be pointed in the right direction that would be appreciated)
Many thanks,
Mike
SolidworksApi macros

https://forum.solidworks.com/f...id=20369&enterthread=y
http://www.lennyworks.com/solidworks/default.asp?ID=20
for the PartNoProperty macro. He specifically tweaked one of hisother macros so I could do exactly what you want above. That newmacro is PartNoProperty.
You will need to add a reference to MS Scripting Runtime libraryunderTools --> References in your VBA window.
http://www.techbookreport.com/tutorials/fso1.html
Dim Fold As String
Dim FileType As String
Sub main()
'Folder Name. Change to folder that has SolidWorks files
Fold = "C:\"
FileType = "*.*"
'This first time prints all files
GetFiles
Debug.Print "*******************"
'Prints all files that end with prt
FileType = "*.*prt"
GetFiles
End Sub
Sub GetFiles()
Dim FileName As String
FileName = Dir(Fold & FileType)
Do While FileName <> ""
Debug.Print FileName
FileName = Dir
Loop
End Sub
Dan