Hi All,
The code below returns an error -Run-time error '1004': Document not saved.
anyone know why?
(Error on line .ExportAsFixedFormat...)
The code below returns an error -Run-time error '1004': Document not saved.
anyone know why?
(Error on line .ExportAsFixedFormat...)
VBA Code:
Private Sub CommandButton1_Click()
Range("B10").Activate
If IsError(ActiveCell) Then
UserForm1.Hide
UserForm3.Show vbModeless
Else
PdfFile = "C:\Users\tougand\Desktop\PHOSPHATE MACRO\" & Range("B7") & Range("B8")
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, fileName:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
ThisWorkbook.Close SaveChanges:=True
End If
Exit Sub
End Sub