localiser l'ouverture de la calculatrice sur une feuille
3 réponses
philwil
Pouvez-vous m'aider ...
j'utilise ce code, mais l'ouverture de la calculatrice masque des données.
je souhaite que cette ouverture soit paramétrée en X,Y sur la feuille.
merci pour votre aide.
philwil
Sub StartCalculator()
Application.ScreenUpdating = False
AppFile = "Calc.exe"
On Error Resume Next
AppActivate ("Calculator")
If Err <> 0 Then
Err = 0
CalcTaskID = Shell(AppFile, 1)
If Err <> 0 Then MsgBox ("Can't start Calculator")
End If
Application.ScreenUpdating = True
End Sub
J'ai pas la réponse à ta question mais pour ouvrir la calculatrice Application.ActivateMicrosoftApp 0 ne suffirait pas ?
AV
Michel Pierron
Bonjour philwil; Pour positionner la calculatrice en haut et à gauche de l'écran: Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long _ , ByVal x As Long, ByVal y As Long, ByVal nWidth As Long _ , ByVal nHeight As Long, ByVal bRepaint As Long) As Long Private Declare Function GetWindowRect Lib "user32" _ (ByVal hwnd As Long, lpRect As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type
Sub StartCalculator() Dim hwnd As Long, Ret As Long, R As RECT Ret = Shell("CALC.EXE", 1) hwnd = FindWindow(vbNullString, "Calculatrice") If hwnd Then GetWindowRect hwnd, R MoveWindow hwnd, 0, 0, R.Right - R.Left, R.Bottom - R.Top, 1 End If End Sub
Tu modifies les paramètres 0, 0 pour placer la calculatrice à l'endroit de ton choix.
MP
"philwil" a écrit dans le message de news:
Pouvez-vous m'aider ... j'utilise ce code, mais l'ouverture de la calculatrice masque des données. je souhaite que cette ouverture soit paramétrée en X,Y sur la feuille.
merci pour votre aide.
philwil
Sub StartCalculator() Application.ScreenUpdating = False AppFile = "Calc.exe" On Error Resume Next AppActivate ("Calculator") If Err <> 0 Then Err = 0 CalcTaskID = Shell(AppFile, 1) If Err <> 0 Then MsgBox ("Can't start Calculator") End If Application.ScreenUpdating = True End Sub
Bonjour philwil;
Pour positionner la calculatrice en haut et à gauche de l'écran:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long _
, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long _
, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare Function GetWindowRect Lib "user32" _
(ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Sub StartCalculator()
Dim hwnd As Long, Ret As Long, R As RECT
Ret = Shell("CALC.EXE", 1)
hwnd = FindWindow(vbNullString, "Calculatrice")
If hwnd Then
GetWindowRect hwnd, R
MoveWindow hwnd, 0, 0, R.Right - R.Left, R.Bottom - R.Top, 1
End If
End Sub
Tu modifies les paramètres 0, 0 pour placer la calculatrice à l'endroit de ton
choix.
MP
"philwil" <philwil@freegates.be> a écrit dans le message de
news:eXkmTXQxDHA.2676@tk2msftngp13.phx.gbl...
Pouvez-vous m'aider ...
j'utilise ce code, mais l'ouverture de la calculatrice masque des données.
je souhaite que cette ouverture soit paramétrée en X,Y sur la feuille.
merci pour votre aide.
philwil
Sub StartCalculator()
Application.ScreenUpdating = False
AppFile = "Calc.exe"
On Error Resume Next
AppActivate ("Calculator")
If Err <> 0 Then
Err = 0
CalcTaskID = Shell(AppFile, 1)
If Err <> 0 Then MsgBox ("Can't start Calculator")
End If
Application.ScreenUpdating = True
End Sub
Bonjour philwil; Pour positionner la calculatrice en haut et à gauche de l'écran: Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long _ , ByVal x As Long, ByVal y As Long, ByVal nWidth As Long _ , ByVal nHeight As Long, ByVal bRepaint As Long) As Long Private Declare Function GetWindowRect Lib "user32" _ (ByVal hwnd As Long, lpRect As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type
Sub StartCalculator() Dim hwnd As Long, Ret As Long, R As RECT Ret = Shell("CALC.EXE", 1) hwnd = FindWindow(vbNullString, "Calculatrice") If hwnd Then GetWindowRect hwnd, R MoveWindow hwnd, 0, 0, R.Right - R.Left, R.Bottom - R.Top, 1 End If End Sub
Tu modifies les paramètres 0, 0 pour placer la calculatrice à l'endroit de ton choix.
MP
"philwil" a écrit dans le message de news:
Pouvez-vous m'aider ... j'utilise ce code, mais l'ouverture de la calculatrice masque des données. je souhaite que cette ouverture soit paramétrée en X,Y sur la feuille.
merci pour votre aide.
philwil
Sub StartCalculator() Application.ScreenUpdating = False AppFile = "Calc.exe" On Error Resume Next AppActivate ("Calculator") If Err <> 0 Then Err = 0 CalcTaskID = Shell(AppFile, 1) If Err <> 0 Then MsgBox ("Can't start Calculator") End If Application.ScreenUpdating = True End Sub
Alain CROS
Bonjour.
Une autre façon de faire.
Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName$, ByVal lpWindowName$) Private Declare Function SetWindowPos& Lib "user32" _ (ByVal Hwnd&, ByVal hWndInsertAfter&, ByVal x&, _ ByVal y&, ByVal cx&, ByVal cy&, ByVal wFlags&) Sub LanceCalc() Const SWP_NOSIZE& = &H1 Application.ActivateMicrosoftApp 0 SetWindowPos FindWindow("SciCalc", vbNullString), _ 0&, 300&, 300&, 0&, 0&, SWP_NOSIZE End Sub
Tu change les deux 300 pour mettre la calculatrice ou tu veux.
Alain CROS.
"philwil" a écrit dans le message de news:
Pouvez-vous m'aider ... j'utilise ce code, mais l'ouverture de la calculatrice masque des données. je souhaite que cette ouverture soit paramétrée en X,Y sur la feuille.
merci pour votre aide.
philwil
Sub StartCalculator() Application.ScreenUpdating = False AppFile = "Calc.exe" On Error Resume Next AppActivate ("Calculator") If Err <> 0 Then Err = 0 CalcTaskID = Shell(AppFile, 1) If Err <> 0 Then MsgBox ("Can't start Calculator") End If Application.ScreenUpdating = True End Sub
Bonjour.
Une autre façon de faire.
Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function SetWindowPos& Lib "user32" _
(ByVal Hwnd&, ByVal hWndInsertAfter&, ByVal x&, _
ByVal y&, ByVal cx&, ByVal cy&, ByVal wFlags&)
Sub LanceCalc()
Const SWP_NOSIZE& = &H1
Application.ActivateMicrosoftApp 0
SetWindowPos FindWindow("SciCalc", vbNullString), _
0&, 300&, 300&, 0&, 0&, SWP_NOSIZE
End Sub
Tu change les deux 300 pour mettre la calculatrice ou tu veux.
Alain CROS.
"philwil" <philwil@freegates.be> a écrit dans le message de news: eXkmTXQxDHA.2676@tk2msftngp13.phx.gbl...
Pouvez-vous m'aider ...
j'utilise ce code, mais l'ouverture de la calculatrice masque des données.
je souhaite que cette ouverture soit paramétrée en X,Y sur la feuille.
merci pour votre aide.
philwil
Sub StartCalculator()
Application.ScreenUpdating = False
AppFile = "Calc.exe"
On Error Resume Next
AppActivate ("Calculator")
If Err <> 0 Then
Err = 0
CalcTaskID = Shell(AppFile, 1)
If Err <> 0 Then MsgBox ("Can't start Calculator")
End If
Application.ScreenUpdating = True
End Sub
Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName$, ByVal lpWindowName$) Private Declare Function SetWindowPos& Lib "user32" _ (ByVal Hwnd&, ByVal hWndInsertAfter&, ByVal x&, _ ByVal y&, ByVal cx&, ByVal cy&, ByVal wFlags&) Sub LanceCalc() Const SWP_NOSIZE& = &H1 Application.ActivateMicrosoftApp 0 SetWindowPos FindWindow("SciCalc", vbNullString), _ 0&, 300&, 300&, 0&, 0&, SWP_NOSIZE End Sub
Tu change les deux 300 pour mettre la calculatrice ou tu veux.
Alain CROS.
"philwil" a écrit dans le message de news:
Pouvez-vous m'aider ... j'utilise ce code, mais l'ouverture de la calculatrice masque des données. je souhaite que cette ouverture soit paramétrée en X,Y sur la feuille.
merci pour votre aide.
philwil
Sub StartCalculator() Application.ScreenUpdating = False AppFile = "Calc.exe" On Error Resume Next AppActivate ("Calculator") If Err <> 0 Then Err = 0 CalcTaskID = Shell(AppFile, 1) If Err <> 0 Then MsgBox ("Can't start Calculator") End If Application.ScreenUpdating = True End Sub