Bonsoir,
merci gbinforme
Après copie/coller du code que tu m'a proposé, tout le code était devenu rouge ce j'ai essayé de corriger. Mais, elle ne fonctionne pas. Voici le code après mon essai de correction
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVallpClassName As String, ByVallpWindowName As String) As Long
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByValhWnd As Long, ByVallpOperation As String, ByVallpFile As String _
, ByVallpParameters As String, ByVallpDirectory As String, ByValnShowCmd As Long) As Long
Public Sub ouvrir_doc()
Const Fic As String = "AVRIL 2017.xlsx" ' fichier
Const Rep As String = "\Fiches 2017\VERIFICATION 2017\" ' sous répertoire
Dim Dcs As String ' mes documents
Dim Nda As Long ' N° de l'application
Dim Wsh As Object ' app. lecture registre
Set Wsh = CreateObject("WScript.Shell")
Nda = FindWindow("XLMAIN", Application.Caption)
Dcs = Wsh.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal")
ShellExecute Nda, "Open", "Dcs& const Rep& const Fic", "", "", 1
Set Wsh = Nothing
End Sub
merci pour l'aide à la correction ou une autre proposition
A voir également:
Ouverture d'un fichier quelque soit son emplacement