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
   | Private Sub Workbook_Open()
 
Dim Retour As String
Dim WordApp As Word.Application
Dim WordDoc1, WordDoc2, WordDoc3, WordDoc4, WordDoc5 As Word.Document
 
Set WordApp = CreateObject("Word.Application")
 
   Retour = InputBox("La description de quelle comparaison souhaitez vous avoir ? ", "Information", "Client? Clause B ?....", 10, 10)
 If Retour = "Client" Then
      WordApp.Visible = True
    Set WordDoc1 = WordApp.Documents.Open("O:\...doc", ReadOnly:=True)
 
 
ElseIf Retour = "Clause Beneficiaire" Then
    WordApp.Visible = True
 Set WordDoc2 = WordApp.Documents.Open("O:\...doc", ReadOnly:=True)
 
 
ElseIf Retour = "Souscript assuré" Then
    WordApp.Visible = True
 Set WordDoc2 = WordApp.Documents.Open("O:\...doc", ReadOnly:=True)
 
 
ElseIf Retour = "Frais acq" Then
    WordApp.Visible = True
 Set WordDoc2 = WordApp.Documents.Open("O:\...doc", ReadOnly:=True)
 
 ElseIf Retour = "Evenement de gestion" Then
    WordApp.Visible = True
 Set WordDoc2 = WordApp.Documents.Open("O:\...doc", ReadOnly:=True)
 
 ElseIf Retour = "Derog op" Then
    WordApp.Visible = True
 Set WordDoc2 = WordApp.Documents.Open("O:\...doc", ReadOnly:=True)
 
 
 ElseIf Retour = "Derog Non op" Then
    WordApp.Visible = True
 Set WordDoc2 = WordApp.Documents.Open("O:\...doc", ReadOnly:=True)
 
ElseIf Retour = "" Then
 Call vide
 Else
 Call nimportequoi
 
End If
End Sub
Private Sub vide()
 
  reponse = MsgBox("vous n'avez rien inscrit! si vous ne voulez rien ouvrir cliquez sur annuler sinon inscrivez le nom du fichier", vbRetryCancel, "Attention")
  If reponse = vbRetry Then
 Call Workbook_Open
 End If
 
 End Sub
Private Sub nimportequoi()
info = MsgBox("Cette comparaison n'existe pas ou vous l'avez mal orthographié!Attention à la casse si vous ne voulez rien ouvrir cliquez sur annuler sinon inscrivez le nom du fichier", vbRetryCancel, "Attention")
 If info = vbRetry Then
Call Workbook_Open
 End If
End Sub | 
Partager