Re, n'ayant ni l'un ni l'autre.
Re,
Grâce à vous j'ai réussi à avoir exactement ce que je voulais, je met le code au cas ou cela intéresse quelqu'un:
Option Explicit
Sub Tst()
Dim Wsh As Worksheet
Dim sChemin As String, NomDossier As String
Dim FSO As Object, i As Long
Do
NomDossier = Application.InputBox("Saisir Année d'Archive:", "Année ?", Year(Date), 1)
Loop While NomDossier = ""
If NomDossier = "" Then Exit Sub 'gestion de la touche annul
If Not IsNumeric(NomDossier) Then
MsgBox ("veuillez saisir un numerique")
NomDossier = Application.InputBox("Saisir Année d'Archive:", "Année ?", Year(Date), 1)
End If
Application.StatusBar = ""
Application.ScreenUpdating = False
sChemin = ThisWorkbook.Path & "\" & NomDossier
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FolderExists(sChemin) = False Then CreationDossier (sChemin)
Set FSO = Nothing
For Each Wsh In ThisWorkbook.Worksheets
i = i + 1
Wsh.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=sChemin & "\" & Wsh.Name, _
quality:=xlQualityStandard, _
includedocproperties:=True, _
ignoreprintareas:=False, _
from:=1, To:=1, _
openafterpublish:=False
Application.StatusBar = i & " / " & ThisWorkbook.Worksheets.Count
Next Wsh
Application.StatusBar = "Terminé"
Application.ScreenUpdating = True
End Sub
Private Function CreationDossier(ByVal sChemin As String) As Boolean
Dim i As Integer, sTmp As String, Ar() As String
If InStr(sChemin, ":") = 0 Then
Ar = Split(CurDir & "\" & sChemin, "\")
Else
Ar = Split(sChemin, "\")
End If
sTmp = Ar(0)
ChDrive sTmp
For i = LBound(Ar) + 1 To UBound(Ar)
If Ar(i) <> "" Then
sTmp = sTmp & "\" & Ar(i)
On Error Resume Next
MkDir sTmp
On Error GoTo 0
End If
Next i
If Dir$(sChemin, vbDirectory) = vbNullString Then
CreationDossier = False
Else
CreationDossier = True
End If
DoEvents
End Function
Merci beaucoup pour ce boulot, c'est top, quelle chance d'avoir accès à ce forme et à tous ces spécialistes...
Bonne soirée kIkI29 (et tous les autres) et Merci encore!!!
Eric