myPath = ThisWorkbook.Path & "\"
sFileName = myPath & "Internal accounts - " & Range("client").Value & " - Management accounts - " & _
Format(Range("manp").Value, "dd mmm yyyy") 'Without .pdf
'Check if file exists
If Dir(sFileName & ".pdf") <> "" Then
sFileName = sFileName & Format(Now(), "_hh-mm")
End If
On Error Resume Next
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
FileName:=sFileName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
I am getting an invalid call arguement when running the following. It is falling down here:
If I take out the 'on error resume next' the bit that follows is highlighted in yellow when i try and do it.
This worked yesterday and as far as I am aware there have been no changes. Is there anything that would make this code so temperamental?
thanks,
dan.
Bookmarks