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
| Sub CheminOffice()
Dim strChemin2013 As String, strChemin2016 As String, strfichier As String
strChemin2013 = "C:\PartageMtl\BD"
strChemin2016 = "C:\Users\" & Environ$("UserName") & "\Documents\PartageMtl\Bd"
strfichier = "projets.accdb"
Dim msg, Style, Title, Help, Ctxt, Response, MyString
msg = "Office 2016 - choisir OUI ?" & Chr(13) & Chr(10) & Chr(13) & "Office 2013 - choisir NON "
Style = vbYesNoCancel + vbCritical + vbDefaultButton1
Title = " BD Projet "
Help = "DEMO.HLP"
Ctxt = 1000
Response = MsgBox(msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
'MsgBox "Office 2016"
VBA.Shell "MsAccess.exe" & " " & strChemin2016 & "\" & strfichier, vbNormalFocus ' fonctionne
ElseIf Response = vbNo Then
MyString = "No" ' Perform some action.
' MsgBox "Office 2013"
VBA.Shell "MsAccess.exe" & " " & strChemin2013 & "\" & strfichier, vbNormalFocus ' fonctionne"
Else
Exit Sub
End If
End Sub |
Partager