Reads values of two cells [C3 is name] [G3/F3 is reference number, actual cell varies] and adds date stamp
Code is not working though. It errors out saying it isn't saved.
Possible because directory does not exist (and I would like to create it if so).
Also would like to automatically replace the file if it exists.
Public Sub PrintReview()
Dim pat_name As Variant, facs As Variant, look_up_sheet As Worksheet, act_sheet As String
act_sheet = ActiveSheet.Name
Set look_up_sheet = ActiveWorkbook.Sheets(act_sheet)
pat_name = look_up_sheet.Range("C3")
If InStr(ThisWorkbook.Name, "New York") Then
facs = look_up_sheet.Range("G3")
Else
facs = look_up_sheet.Range("F3")
End If
ChDir "J:\" & pat_name
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"j:\" & pat_name & "\" & pat_name & " - " & Format(Date, "mmddyy") & " - " & facs & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
End Sub
Bookmarks