salut
je cherche pourquoi le code si après me demande de saisir le mot de passe du fichier document au lieu de s'occuper lui même de la tache;
merci
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 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim objWord As Object Dim strPassword As String = "mypasstring" objWord = CreateObject("Word.Application") objWord.visible = False objWord.application.WindowState = 2 objWord.application.DisplayAlerts = False Try objWord.Documents.Open(Application.StartupPath & "\certificat.doc", PasswordDocument:=strPassword) Process.Start(Application.StartupPath & "\certificat.doc") Catch ex As Exception MsgBox("Cannot open word document", vbExclamation, "Password Protected") End Try End Sub
Partager