Hi!
I am a true newbie with VBA.
I found this code to work with a button click and i need help to add a way to choose where i want to save my pdf files with the filename generate by this code. For the moment its saving on the Desktop without any choice but i prefer to choose the right folder.
Thanks
-------------------------------------
Private Sub cbSaveAsPDF_Click()
Dim sPath As String, sFile As String, sFullName As String
On Error GoTo ErrHandler
If Not IsEmpty(Me.Range("B2")) Then
sPath = ThisWorkbook.Path & Application.PathSeparator
sFile = Me.Range("B2").Value & Format(Range("I2").Value, "hh-mm-ss") & ".pdf"
sFullName = sPath & sFile
Me.ExportAsFixedFormat _
Type:=xlTypePDF, _
FileName:=sFullName, _
Quality:=xlQualityStandard
End If
ExitHandler:
Exit Sub
ErrHandler:
MsgBox "Erreur : " & Err.Number & Chr(10) & Err.Description
Resume ExitHandler
End Sub
I am a true newbie with VBA.
I found this code to work with a button click and i need help to add a way to choose where i want to save my pdf files with the filename generate by this code. For the moment its saving on the Desktop without any choice but i prefer to choose the right folder.
Thanks
-------------------------------------
Private Sub cbSaveAsPDF_Click()
Dim sPath As String, sFile As String, sFullName As String
On Error GoTo ErrHandler
If Not IsEmpty(Me.Range("B2")) Then
sPath = ThisWorkbook.Path & Application.PathSeparator
sFile = Me.Range("B2").Value & Format(Range("I2").Value, "hh-mm-ss") & ".pdf"
sFullName = sPath & sFile
Me.ExportAsFixedFormat _
Type:=xlTypePDF, _
FileName:=sFullName, _
Quality:=xlQualityStandard
End If
ExitHandler:
Exit Sub
ErrHandler:
MsgBox "Erreur : " & Err.Number & Chr(10) & Err.Description
Resume ExitHandler
End Sub