Protéger une page Word depuis Excel
Bonsoir,
Cela fais 2 heures que je cherche une solution à mon problème et je craque... J'ai besoin de votre aide!
Je dois enlever une protection Word pour modifier son contenue mais lorsque je la réactive , aucune protection n'est présente sur la page..
Pourtant aucun message d'erreur , rien ne se passe..
Je pense que cela est tout bête mais je ne trouve pas.. Merci de votre aide !
Voici mon code :
Code:
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
| Set WordApp = CreateObject("word.Application")
With WordApp
.Visible = True
.WindowState = wdWindowStateMaximize
RepertoireFichier = LeRep2
Set WordDoc = .Documents.Open(RepertoireFichier & sNomDossier & ".docm") ' A adapter
With WordDoc
.Activate
.Unprotect Password:="********"
If .Shapes.Count > 0 Then
For I = 3 To .Shapes.Count
If .Shapes(I).Type = 1 Then ' Se reporter aux
With .Shapes(10) 'date
.TextFrame.TextRange.Text = date2
End With
With .Shapes(11) 'n° inter
.TextFrame.TextRange.Text = sNomDossier
End With
With .Shapes(12) ' site
.TextFrame.TextRange.Text = chantier
End With
With .Shapes(13) 'ref
.TextFrame.TextRange.Text = ref
End With
With .Shapes(14) 'client
.TextFrame.TextRange.Text = client
End With
With .Shapes(15) 'numser
.TextFrame.TextRange.Text = numser
End With
With .Shapes(16) 'marque
.TextFrame.TextRange.Text = marque
End With
With .Shapes(9) 'produit
.TextFrame.TextRange.Text = produit
End With
With .Shapes(8) 'contact
.TextFrame.TextRange.Text = contact
End With
With .Shapes(7) 'adresse
.TextFrame.TextRange.Text = adresse
End With
With .Shapes(6) 'site
.TextFrame.TextRange.Text = site
End With
End If
Next I
End If
.Protect Password:="********", NoReset:=False, Type:= _
wdAllowOnlyFormFields
End With
Set WordDoc = Nothing
End With
Set WordApp = Nothing |