Hi,
I am using excel 2016 (o365), and i used to have a similar formula on another job on excel 2013, but somehow i can't grasp where it fails...
here's my script
Sub RangeToPdf()
Dim fp As String
fp = "C:\Users\xxxxxxxxxx\stats PDF"
With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
Debug.Print fp
Debug.Print "Path Exists: ", Len(Dir(fp, vbDirectory)) <> 0
Debug.Print fp & Range("b10").Value & Range("b6").Value & Range("d10").Value & Range("b1").Value
Range("A1:K42").ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=fp & Range("B10").Value & Range("B6").Value & Range("D10").Value & Range("B1").Value, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
End Sub
The red section is highligted in yellow, and i get the error "document not saved"
Clues?
Bookmarks