Hi all
Me again
So I have another one that doesn't give me any errors, but it is also not executing the code.
It gives the correct msgbox and filename but when pressing save absolutely nothing happens. It doesn't actually execute the code.
Not sure why.
Private Sub CommandButton3_Click()
answer = msgbox("Do you want to export the application to PDF?", vbYesNo + vbQuestion, "Export Application to PDF")
If answer = vbYes Then
filesSaveName = Application.GetSaveAsFilename(Sheet49.Range("P13"), fileFilter:="PDF (*.pdf), *.pdf")
If fileSaveName <> False Then
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, filename:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
End If
End Sub
I am using the exact code in another document and it works perfectly. The only difference is Button and CommandButton. Can that be it? Here is the other documents code that works.
Sub Button3_Click()
answer = MsgBox("Do you want to export to PDF?", vbYesNo + vbQuestion, "Export to PDF")
If answer = vbYes Then
fileSaveName = Application.GetSaveAsFilename(Sheet4.Range("D39"), fileFilter:="PDF (*.pdf), *.pdf")
If fileSaveName <> False Then
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, filename:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
End If
End Sub
Thank you!
A
Me again
So I have another one that doesn't give me any errors, but it is also not executing the code.
It gives the correct msgbox and filename but when pressing save absolutely nothing happens. It doesn't actually execute the code.
Not sure why.
Private Sub CommandButton3_Click()
answer = msgbox("Do you want to export the application to PDF?", vbYesNo + vbQuestion, "Export Application to PDF")
If answer = vbYes Then
filesSaveName = Application.GetSaveAsFilename(Sheet49.Range("P13"), fileFilter:="PDF (*.pdf), *.pdf")
If fileSaveName <> False Then
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, filename:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
End If
End Sub
I am using the exact code in another document and it works perfectly. The only difference is Button and CommandButton. Can that be it? Here is the other documents code that works.
Sub Button3_Click()
answer = MsgBox("Do you want to export to PDF?", vbYesNo + vbQuestion, "Export to PDF")
If answer = vbYes Then
fileSaveName = Application.GetSaveAsFilename(Sheet4.Range("D39"), fileFilter:="PDF (*.pdf), *.pdf")
If fileSaveName <> False Then
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, filename:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
End If
End Sub
Thank you!
A