Hello
I'm taking up the torch of macro editing at my job, but without the basics in VBA, so I'm mostly doing DIY/adaptation rather than coding for now, and after several unsuccessful searches and tests, here I am.
The problem is simple, today my PDF recording macro simply keeps the same file name as the DRW: 2263-4B.slddrw -> 2263-4B.pdf
I would like the macro to automatically add characters just before the file name when generating PDFs, as follows: 2263-4B.slddrw -> CK-2263-4B.pdf
Below is the part that concerns the recording in PDF:
-------------------------------------------------------------------------------------------
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim PathName As String
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
If MsgBox("Would you like to save as PDF?", vbQuestion + vbYesNo, "PDF") = vbNo Then
MsgBox "Cancelled", vbOKOnly, "PDF"
Exit Sub
End If
PathName = Mid(swModel.GetPathName, 1, Len(swModel.GetPathName) - 7)
swModel.SaveAs2 PathName & ".PDF", 0, True, False
End Sub
-------------------------------------------------------------------------------------------
(Lynkoa's "Insert code snippet" option was bugging my message)
I tried several basic things, like just adding "CK-" & right after PathName = , but without success. Does anyone have a solution to this little problem?
Thank you in advance.