Hello,
Hello,
Does anyone know how to add the VBA code to perform the printing task on the code below?
I am using Excel for Mac V16.42
Please note that the range to be printed needs to be from A1 to last row with data as the content of the table will change depending on what user add in.
This is my first post here, if there is anything missing or not right on this post, please just let me know.
Any help welcomed. Thank you very much.
[Sub Button1_Click()
Dim LstRw As Long
Dim Rng As Range
Const NameAdd = "A4"
Dim FileName As String
Dim WkP As String
Dim Answer As VbMsgBoxResult
Answer = MsgBox("Save Quote?", vbYesNo)
If Answer = vbYes Then
LstRw = Cells(Rows.Count, "A").End(xlUp).Row
Set Rng = Range("A1:G" & LstRw)
ActiveSheet.PageSetup.PrintArea = Rng.Address
WkP = "/Volumes/GoogleDrive/My Drive/Nas My Cloud/Global Grooves/Costumes and Making/Packing Lists"
FileName = Range(NameAdd) & "_" & Format(Now(), "YYMMDD") & ".pdf"
FileName = WkP & Application.PathSeparator & FileName
ActiveSheet.PageSetup.PrintArea = Rng.Address
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True
Range("H5,H1,H9:H21").Select
Selection.ClearContents
Range("E1").Select
End If
End Sub]
Hello,
Does anyone know how to add the VBA code to perform the printing task on the code below?
I am using Excel for Mac V16.42
Please note that the range to be printed needs to be from A1 to last row with data as the content of the table will change depending on what user add in.
This is my first post here, if there is anything missing or not right on this post, please just let me know.
Any help welcomed. Thank you very much.
[Sub Button1_Click()
Dim LstRw As Long
Dim Rng As Range
Const NameAdd = "A4"
Dim FileName As String
Dim WkP As String
Dim Answer As VbMsgBoxResult
Answer = MsgBox("Save Quote?", vbYesNo)
If Answer = vbYes Then
LstRw = Cells(Rows.Count, "A").End(xlUp).Row
Set Rng = Range("A1:G" & LstRw)
ActiveSheet.PageSetup.PrintArea = Rng.Address
WkP = "/Volumes/GoogleDrive/My Drive/Nas My Cloud/Global Grooves/Costumes and Making/Packing Lists"
FileName = Range(NameAdd) & "_" & Format(Now(), "YYMMDD") & ".pdf"
FileName = WkP & Application.PathSeparator & FileName
ActiveSheet.PageSetup.PrintArea = Rng.Address
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True
Range("H5,H1,H9:H21").Select
Selection.ClearContents
Range("E1").Select
End If
End Sub]