Bonjour,

Je développe une application avec Visual Studio 2010 en VB et je créer des documents Word et Excel (2010).

J'arrive à protéger les documents afin qu'ils ne puissent être modifié. Par contre, je voudrais pouvoir autoriser certains utilisateurs à avoir tous les droits sur ces documents protégés. Comment faire ?

Voici mon code actuel :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 Private Sub ButtonTestDivers_Click(sender As Object, e As System.EventArgs) Handles ButtonTestDivers.Click
 
        Dim WordApp As Microsoft.Office.Interop.Word.Application
        Dim WordDoc As Microsoft.Office.Interop.Word.Document
        Dim WordSection As Microsoft.Office.Interop.Word.Section
        Dim WordRange As Microsoft.Office.Interop.Word.Range
 
 
 
        WordApp = CType(CreateObject("Word.Application"), Microsoft.Office.Interop.Word.Application)
        WordApp.Visible = True
        WordDoc = WordApp.Documents.Open("P:\Compta\_Essais.docx")
        WordSection = WordApp.ActiveDocument.Sections(1)
        WordRange = WordSection.Headers(Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range
        WordRange.Delete()
        WordApp.ActiveDocument.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyReading, False, "xxxxx", False, False)
 
 
 
    End Sub
Comment maintenant autoriser un utilisateur à avoir tous les droits sans supprimer l'interdiction de modification aux autres utilisateurs ?

Merci beaucoup de votre réponse