Hi Guys,
I have some buttons on my excel sheet that print my workbook. Ive recently added pdf printing to that list.
I would like it to check if the pdf file exists, save pdf if it does not. Message box [Yes, No, Cancel] if it does exist, Yes: creates pdf, No: prompts SaveAs dialog, Cancel: ends without Pdf changes . It "almost" works.
PROBLEM: If there is no PDF there it does not detect this. It always comes up with the dialog box.
Guessing my learner skills are not what i think they are. (read: basterdise other people's code from online)
Thanks for the help 
Dim WorkbookName As String
WorkbookName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
If ActiveWorkbook.Path & "\" & WorkbookName & ".pdf" = "" Then
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False, _
Filename:= _
ActiveWorkbook.Path & "\" & WorkbookName & ".pdf"
Else
Select Case MsgBox("This file exists. Continue & overwrite? No to SaveAs", vbYesNoCancel, "PDF Creation")
Case vbYes
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False, _
Filename:= _
ActiveWorkbook.Path & "\" & WorkbookName & ".pdf"
Case vbNo
Dim bFileSaveAs As Boolean
bFileSaveAs = Application.GetSaveAsFilename(InitialFileName:=ActiveWorkbook.Name, fileFilter:="PDF (*.pdf), *.pdf")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=bFileSaveAs
Case vbCancel
Exit Sub
End Select
End If
Bookmarks