For months this has been working and then today it randomly stopped working. ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, ignoreprintareas:=False, FileName:=path & fname & ".pdf" is what was highlighted so the error must be there. Please help.
Sub SaveAsPdf()
Dim invno As Long
Dim custname As String
Dim amt As Currency
Dim dt_issue As Date
Dim term As Byte
Dim path As String
Dim fname As String
Dim nextrec As Range
invno = Range("C3")
custname = Range("B9")
amt = Range("H40")
dt_issue = Range("C4")
term = Range("C5")
path = "D:\Content\Invoices"
fname = invno & " - " & custname
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, ignoreprintareas:=False, FileName:=path & fname & ".pdf"
Set nextrec = Sheet4.Range("A1048576").End(xlUp).Offset(1, 0)
nextrec = invno
nextrec.Offset(0, 1) = custname
nextrec.Offset(0, 2) = amt
nextrec.Offset(0, 3) = dt_issue
nextrec.Offset(0, 4) = dt_issue + term
Sheet4.Hyperlinks.Add anchor:=nextrec.Offset(0, 6), Address:=path & fname & ".pdf"
Exit Sub
End Sub
Bookmarks