Sub RunMe() Dim mPath, mPathFile As String Dim oW As Long mPath = "C:\Users\OSE\Downloads\client\" & ActiveSheet.Range("H2").Value & "\" mPathFile = mPath & ActiveSheet.Range("I2").Value If Dir(mPath, vbDirectory) = vbNullString Then MkDir mPath GoTo sFile End If If CBool(Len(Dir$(mPathFile & ".pdf")) > 0) = True Then oW = MsgBox("Overwrite existing file?", vbQuestion + vbYesNo, "File Exists") If oW = vbYes Then GoTo sFile Else Exit Sub End If Else GoTo sFile End If Exit Sub sFile: ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=mPathFile _ , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ :=False, OpenAfterPublish:=False End Sub
DON'T MISS
thanks again
Good to hear!
To prevent the missing data error, paste the piece of code between code line 3 and 5:
Best regards,
Trowa
best regards,
abdelfattah