Advertisement
YasserKhalil2019

T4667_Export Specific Range To PDF

Mar 1st, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. https://excel-egy.com/forum/t4667
  2. ---------------------------------
  3.  
  4. Private Sub CommandButton1_Click()
  5. Dim msg As String, fn As String, f As Boolean
  6.  
  7. msg = MsgBox("Will You Open The PDF File?", vbQuestion + vbYesNo)
  8. If msg = vbYes Then f = True
  9.  
  10. With ThisWorkbook.Sheets(1)
  11. fn = .Range("C6").Value
  12. .Range("A2:H41").ExportAsFixedFormat Type:=xlTypePDF, FileName:=ThisWorkbook.Path & "\" & fn & ".pdf", OpenAfterPublish:=f
  13. End With
  14. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement