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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| Private Sub OptionButton379_Click()
altern.Hide
Insert.Show
Set adoc = ActiveDocument
If adoc.ProtectionType <> wdNoProtection Then Protection = 1
If adoc.ProtectionType <> wdNoProtection Then
adoc.Unprotect
End If
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Les conditions d'octroi n'étaient pas remplies parce que"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
ActiveDocument.MailMerge.OpenDataSource Name:="C:\temp\Lien_Itinera.xls", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\temp\Lien_Itinera.xls;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=35;Jet OLE" _
, SQLStatement:="SELECT * FROM `wfl$`", SQLStatement1:="", SubType:= _
wdMergeSubTypeAccess
Selection.Font.Bold = wdToggle
Selection.TypeText Text:="Concerne :"
Selection.TypeParagraph
Selection.TypeParagraph
Selection.Font.Bold = wdToggle
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""SIGLE_DEST"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""NOM_DEST"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""PRENOM_DEST"""
Selection.TypeText Text:=" --- "
Selection.Font.Bold = wdToggle
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""NUMN"""
Selection.Font.Bold = wdToggle
Selection.TypeParagraph
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""ADRESSE_DEST"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""CBOITE_DEST"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""BOITE_DEST"""
Selection.TypeText Text:=" - "
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""CP_DEST"""
Selection.TypeText Text:=" "
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""LOCALITE_DEST"""
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeText Text:="Nos références : "
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""DOSSIER_NRO"""
Selection.TypeText Text:="/"
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:="""NUMERO_AGT"""
Selection.TypeParagraph
Selection.Font.Bold = wdToggle
Selection.TypeText Text:="Vos références : "
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle
Selection.TypeParagraph
Selection.Font.Bold = wdToggle
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=7, Extend:=wdExtend
Selection.Fields.Unlink
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
If Protection = 1 Then WordBasic.ToolsProtectDocument DocumentPassword:="", NoReset:=1, Type:=2
Documents("Itinera_aaaNormal.dot").Activate
ActiveDocument.Close False
End Sub |
Partager