Redimensionner une application autre qu'Excel

Bonjour et merci d'avance,

je souhaite redimensionner une fenêtre et la mettre en haut à gauche de l'écran. C'est une application autre que Excel. Voici un bout de code mais je n'arrive pas à la placer et redimensionner comme je veux. Ça me redimensionne ma fenêtre Excel...

Dim Cible As Variant
Cible = Shell("C:\Program Files\RealVNC\VNC Viewer\vncviewer.exe ", 1)
Application.SendKeys "01- W508 MT", True
Application.SendKeys "~", True
With ActiveWindow
Application.WindowState = xlNormal
Application.Width = 637.5
Application.Height = 470.25
Application.Left = 84.25
Application.Top = 154
End With

quelqu'un aurait-il une p'tite idée ?

merci grandement

Bonjour,

Peux-tu tester ceci :

Option Explicit
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 Sub Resize_Win()
Dim WinHandle As Long
  Shell "C:\Program Files\RealVNC\VNC Viewer\vncviewer.exe", vbNormalFocus
  WinHandle = FindWindow("vncviewer", vbNullString)
  MoveWindow WinHandle, 84, 154, 640, 470, 1
End Sub

Bonjour Oxydum,

Merci mais malheureusement ça ne fonctionne pas...

Ci-joint un classeur avec un notepad à cliquer.

10notepad.xlsm (26.87 Ko)

Merci çà fonctionne pour votre fichier !

mon fichier s'appelle :

  WinHandle = FindWindow("01- W508 MT (stdftrs01)- VNC Viewer", vbNullString)

mais il ne se redimensionne pas...

nom de fichier

Du coup tu y es presque !

Essaie d'inverser :

  WinHandle = FindWindow(vbNullString, "01- W508 MT (stdftrs01)- VNC Viewer")

Bonjour Oxydum,

merci pour la réponse qui fonctionne !

Rechercher des sujets similaires à "redimensionner application"