Message 1 of 3
incremental file names
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys, i am using some code that will save my file in the name of the following
"MP-001-plaat " & length & "X" & width & "X" & Thickness & "mm"
In the line the ''001'' inside ''MP-001-plaat'' represents the part number in the folder of the project. Inside the folder i arrange all the parts incremental. So every part starts with ''MP-00n' with n+1 for every new part.
Anyone knows how i can adjust the code that every new created parts checks the numbers in the folder location, and adds the next number to the next saved part.
The full code that i am using is:
Dim oDoc As Inventor.Document = ThisApplication.ActiveDocument Dim FName As String = oDoc.FullFileName Dim FNP As Integer = InStrRev(FName, "\", -1) Dim oPath As String = Left(FName, FNP) Dim oNewName As String = "MP-001-plaat " & lengte & "X" & breedte & "X" & Thickness & "mm" ' If the user closes the input box, then stop the function 'If oNewName = vbNullString Then Exit Sub Dim oType As String Select Case oDoc.DocumentType Case kPartDocumentObject: oType = ".ipt" Case kAssemblyDocumentObject: oType = ".iam" Case kDrawingDocumentObject: oType = ".idw" End Select oDoc.SaveAs(oPath & oNewName & oType, True)
With kind regards, michiel