Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
berry.lejeune
in reply to: PumaBH

Hi, 

 

I'm using a code that I activate when I want to make a pdf

The code creates two pdf's. One on a specific location in our network and one in the folder where the IDW is. In that folder a new folder is made "PDF" and the folder will also open automatically after the pdf has been created

 

Here's the code:

On Error Resume Next

'define the folder where you want to save the files
oFolder = "g:\pdf\2024\"

'grab the filename
oFileName = ThisDoc.FileName(False) 'without extension

'create the folder if it doesn't exist
If Not System.IO.Directory.Exists(oFolder) Then 
    System.IO.Directory.CreateDirectory(oFolder)
End If


'save as a pdf
ThisDoc.Document.SaveAs(oFolder & oFileName & - 1 & ".pdf", True)

oPath = ThisDoc.Path
'get STEP target folder path
oFolder = oPath & "\" & oAsmName & " PDF"
'Check for the step folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If
ThisDoc.Document.SaveAs(oFolder & "\" & oFileName & " - 1" &(".pdf"), True)

'open the folder where the new files are saved
Shell("explorer.exe " & oFolder,vbNormalFocus)