
Sub SalvaPDF_Stampa()
Dim sPath As String
Dim sNome As String
Dim Ling As String
Dim ws As Worksheet
Set ws = ActiveSheet
Ling = ActiveSheet.Name
Application.DisplayAlerts = False
'On Error Resume Next
ActiveSheet.Select
With Selection
sPath = .Path
With .ws
sNome = Ling
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=sPath & "" & sNome & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
MsgBox "File " & sPath & "" & sNome & " salvato", vbInformation, ".PDF "
End With
Exit Sub
End With
Application.DisplayAlerts = True
ws = Nothing
End Sub |
Private Sub OptionButton2_Click() strFilePath = "F:Download" ' <<<<<<<<< da modificare strPdfName = ActiveSheet.Name ActiveSheet.Copy ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFilePath & strPdfName, _ Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ OpenAfterPublish:=False ActiveWorkbook.Close (False) End Sub |
Private Sub CommandButton1_Click()
'STAMPA
Dim ws As Worksheet
Set ws = ActiveSheet
Set xFogliostampa = ws '< nome foglio da adattare
' stampo il foglio
xFogliostampa.PrintOut
Set xFogliostampa = Nothing
End Sub
Private Sub CommandButton2_Click()
Dim sPath As String
Dim sNome As String
Dim ws As Worksheet
Set ws = ActiveSheet
Application.DisplayAlerts = False
'On Error Resume Next
With ThisWorkbook
sPath = .Path
With ws
' nome foglio attivo da salvare
sNome = ws.Name
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=sPath & "" & sNome & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
MsgBox "File " & sPath & "" & sNome & " salvato", vbInformation, " PDF "
End With
Exit Sub
End With
Set ws = Nothing
Application.DisplayAlerts = True
End Sub
Private Sub OptionButton1_Click()
' stampa
End Sub
Private Sub OptionButton2_Click()
'salva
Dim strfilePath As String
strfilePath = "C:UsersPippoDesktop" ' <<<<<<<<< da modificare
'strFilePath = [P1]
strPdfName = ActiveSheet.Name
ActiveSheet.Copy
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strfilePath & strPdfName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
ActiveWorkbook.Close (False) |
