Hello All,
Quick macro question with regards to exporting PDFs from Workgroup PDM. I have this terrific script by Steve Takata that exports all the PDFs from the vault (the PDFs are created automatically during check-in) but I'm having a lower/uppercase problem. The line highlighted in bold below removes the .SLDDRW from the PDF filename and adds the Rev instead. Problem is it only does this for drawing files where the extension is uppercase (.SLDDRW), not lowercase (.slddrw). How do I tell the macro to remove .SLDDRW regardless of case?
-----
For Each result In results
'If the document has an embedded PDF, then...
If result.Document.HasPDF <> 0 Then
'Create the new filename, deleting ".SLDDRW", inserting separator "-" and the revision
filename = thisPath & "\" & Replace(result.Name, ".SLDDRW", "") & " - Rev " & result.Revision & ".pdf"
'Check to see if the target file name already exists. If so then skip file creation.
If Dir(filename) = "" Then
'Save out the embedded pdf to the path
'NOTE: this will save "filename.SLDDRW.pdf"
result.Document.SaveAsPDF (thisPath)
'Rename the file saved above to the target filename
Name thisPath & "\" & result.Name & ".pdf" As filename
End If
End If
Next
-----
Complete macro is attached in a zip file.
SolidworksApi macros