The PDF name gets created at this line:
bRet = swDoc.Extension.SaveAs(outputPath + outputFileName + " - " + sheetNames(i) + ".pdf", SwConst.swSaveAsVersion_e.swSaveAsCurrentVersion, SwConst.swSaveAsOptions_e.swSaveAsOptions_Silent, swExporter, lErrors, lWarnings)
This will be the complete path:
outputPath + outputFileName + " - " + sheetNames(i) + ".pdf"
You can change that into whatever you like. To read a custom property, you need to create a Custom Property Manager that you can use to get the values of custom properties, like in this example:
You can read in the custom properties, concatenate them as you like and then create the PDFs. It'll be only a few extra lines, you've got the basics in that macro already.
Thanks for explaining some of this. I'll try to catch up some understanding in code, but at this moment I have 1 out of 10, experience in the VBA... I'm doubtful getting through this in a few hours... :-/ But I'll have a look!
You can pull both model and drawing properties as string and add into the output file name.
Since model has both custom and configuration properties, you need to use the codes based on what property you need. For example, for getting the model custom properties from the drawing, you need to use
'Get Model Custom Property
Dim swSheet As SldWorks.Sheet
Dim value As String
Dim resolvedValOut As String
Dim swView As SldWorks.View
Dim swModel As ModelDoc2
Dim swCustProp As CustomPropertyManager
Set swSheet = swDwgDoc.GetCurrentSheet
Set swView = swDwgDoc.GetFirstView
Set swView = swView.GetNextView
Set swModel = swView.ReferencedDocument
Set swCustProp = swModel.Extension.CustomPropertyManager("")
swCustProp.Get2 "Article Number", value, resolvedValOut
You can also try this awesome tool called #TASK and use the inbuilt PDF creation tool. Set output file name, folder and other options as needed. No coding required