1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
Option Explicit
Function GroupeDateHeure() As String
Dim MaDate As Variant
Dim HeureEnCours As Variant
MaDate = Split(CStr(Date), "/")
HeureEnCours = Split(Time, ":")
GroupeDateHeure = MaDate(2) & "-" & MaDate(1) & "-" & MaDate(0) & " H " & Join(HeureEnCours, "-")
End Function
Sub Essai()
Dim SRep As String, SFilename As String
'SRep = ActiveWorkbook.Path
SRep = "C:\Temp"
SFilename = "toto" & " " & GroupeDateHeure & "." & "pdf" ' Nom du fichier
Range("B2:G16").ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=SRep & "\" & SFilename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub |
Partager