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
| Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL = 1
Private Sub Ouvrir(sNomFichier As String)
Dim Rep As Integer, hwnd As Long
Rep = ShellExecute(hwnd, "Open", sNomFichier, 0&, 0&, SW_SHOWNORMAL)
End Sub
Sub Tst()
Dim sDossier As String
Dim sFichier As String
sDossier = ThisWorkbook.Path
sFichier = Feuil1.Range("A1")
With Feuil2
.Activate
.Cells.Clear
.Range("A1").Select
End With
Ouvrir (sDossier & "\" & sFichier)
Application.Wait (Now + TimeValue("0:00:05"))
SendKeys "^a"
SendKeys "^c"
Application.Wait (Now + TimeValue("0:00:05"))
SendKeys "^v"
End Sub |
Partager