bonjour à tous
pourriez vous me dire si il est possible d'incorporer un exécutable dans une
feuille excel ?
Soit :
Dans un dossier j'ai un petit exécutable disons "aaaaaaaa.exe"
J'ai créé une feuille excel dans laquelle je souhaite que cet exécutable
apparaisse à l'ouverture de la feuille excel a partir de C4 à G17 (par
exemple)
C'est à dire que quand j'ouvre la feuille excel, l'exécutable en fasse
partie intégrante et que je puisse me servir des 2 en même temps.
Si il y a possibilité, pouvez vous m'indiquer la marche à suivre ?
Private Const Flags = SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
Private Declare Function FindWindowA Lib "user32" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" _ (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _ ByVal x As Long, ByVal y As Long, ByVal cx As Long, _ ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function PostMessage Lib "user32" _ Alias "PostMessageA" (ByVal hWnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Function SetTopMostWindow(hWnd As Long, Topmost As Boolean) As Long If Topmost = True Then SetTopMostWindow = SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, Flags) Else SetTopMostWindow = SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, Flags) End If End Function
Sub Afficher_Fermer_Calculatrice() hWnd = FindWindowA(vbNullString, "Calculatrice") If hWnd = 0 Then Shell "C:WINNTsystem32Calc.exe" '<----------chemin du *.exe hWnd = FindWindowA(vbNullString, "Calculatrice") SetTopMostWindow hWnd, True Else SetTopMostWindow hWnd, False PostMessage hWnd, WM_CLOSE, 0&, 0& hWnd = 0 End If End Sub
bonjour à tous pourriez vous me dire si il est possible d'incorporer un exécutable dans une feuille excel ?
Soit : Dans un dossier j'ai un petit exécutable disons "aaaaaaaa.exe" J'ai créé une feuille excel dans laquelle je souhaite que cet exécutable apparaisse à l'ouverture de la feuille excel
a partir de C4 à G17 (par exemple)
C'est à dire que quand j'ouvre la feuille excel, l'exécutable en fasse partie intégrante et que je puisse me servir des 2 en même temps.
Si il y a possibilité, pouvez vous m'indiquer la marche à suivre ?
Merci de vos réponses et bon WE Pascal
bonjour Pascal,
voici un exemple (de MichD) trouvé sur le forum ponx pour afficher la calculatrice Windows,
il faudra l'adapter à ton .exe
Private Const Flags = SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" _
(ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function PostMessage Lib "user32" _
Alias "PostMessageA" (ByVal hWnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Function SetTopMostWindow(hWnd As Long, Topmost As Boolean) As Long
If Topmost = True Then
SetTopMostWindow = SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, Flags)
Else
SetTopMostWindow = SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, Flags)
End If
End Function
Sub Afficher_Fermer_Calculatrice()
hWnd = FindWindowA(vbNullString, "Calculatrice")
If hWnd = 0 Then
Shell "C:WINNTsystem32Calc.exe" '<----------chemin du *.exe
hWnd = FindWindowA(vbNullString, "Calculatrice")
SetTopMostWindow hWnd, True
Else
SetTopMostWindow hWnd, False
PostMessage hWnd, WM_CLOSE, 0&, 0&
hWnd = 0
End If
End Sub
bonjour à tous
pourriez vous me dire si il est possible d'incorporer un exécutable dans une feuille excel ?
Soit :
Dans un dossier j'ai un petit exécutable disons "aaaaaaaa.exe"
J'ai créé une feuille excel dans laquelle je souhaite que cet exécutable apparaisse à l'ouverture de la feuille excel
a partir de C4 à G17 (par exemple)
C'est à dire que quand j'ouvre la feuille excel, l'exécutable en fasse partie intégrante et que je puisse me servir des 2 en même temps.
Si il y a possibilité, pouvez vous m'indiquer la marche à suivre ?
Private Const Flags = SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
Private Declare Function FindWindowA Lib "user32" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" _ (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _ ByVal x As Long, ByVal y As Long, ByVal cx As Long, _ ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function PostMessage Lib "user32" _ Alias "PostMessageA" (ByVal hWnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Function SetTopMostWindow(hWnd As Long, Topmost As Boolean) As Long If Topmost = True Then SetTopMostWindow = SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, Flags) Else SetTopMostWindow = SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, Flags) End If End Function
Sub Afficher_Fermer_Calculatrice() hWnd = FindWindowA(vbNullString, "Calculatrice") If hWnd = 0 Then Shell "C:WINNTsystem32Calc.exe" '<----------chemin du *.exe hWnd = FindWindowA(vbNullString, "Calculatrice") SetTopMostWindow hWnd, True Else SetTopMostWindow hWnd, False PostMessage hWnd, WM_CLOSE, 0&, 0& hWnd = 0 End If End Sub
bonjour à tous pourriez vous me dire si il est possible d'incorporer un exécutable dans une feuille excel ?
Soit : Dans un dossier j'ai un petit exécutable disons "aaaaaaaa.exe" J'ai créé une feuille excel dans laquelle je souhaite que cet exécutable apparaisse à l'ouverture de la feuille excel
a partir de C4 à G17 (par exemple)
C'est à dire que quand j'ouvre la feuille excel, l'exécutable en fasse partie intégrante et que je puisse me servir des 2 en même temps.
Si il y a possibilité, pouvez vous m'indiquer la marche à suivre ?