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 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
Sub VerifieExistenceRepertoire()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "D743/"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
With Selection
.MoveRight Unit:=wdWord, Count:=1, Extend:=6
If Selection.Fields.Count = 1 Then Selection.Fields(1).Update
End With
Dim NumDossier As Variant
Set NumDossier = ActiveDocument.Range(Selection.Start + 5, Selection.End)
Dim NomCourrier As String
NomCourrier = NumDossier & "_AVIS"
Dim Chemin As String
Chemin = "C:\Users\AG23984N\Desktop\Nouveau dossier\" & NumDossier & "*"
Application.changefileopendirectory "C:\Users\AG23984N\Desktop\Nouveau dossier\" & NumDossier & "*"
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
NomCourrier + MES, ExportFormat:= _
wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
End Sub |
Partager