Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

VBA EXCEL - OUVRIR WINDOWS EXPLORER ET DEFINIR TAILLE FENETRE

15 réponses
Avatar
29Eric29
Bonjour,

Je cherche à ouvrir 4 fenêtres "windows explorer" en imposant leur taille et position sur l'écran.

J'ai trouvé un code qui fonctionne parfaitement pour ouvrir "notepad.exe" (et positionner les fenêtres en définissant leur taille) et je cherche à l'adapter pour "explorer.exe".
https://www.experts-exchange.com/questions/28323487/MoveWindow-in-VBA-in-EXCEL.html


Je pensais que remplacer :
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
par :
np_retval = Shell("C:windowsexplorer.exe", vbNormalFocus)
suffirait....mais ça n'est pas si simple j'ai l'impression ?


Voici le code si quelqu'un avait une idée pour l'adapter à explorer.exe ?? :

Un grand merci d'avance...et bonne journée

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Option Explicit

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

Public Const GW_HWNDNEXT As Long = 2
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwprocessid As Long) As Long

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub tile1()
Dim retval As Long, np_retval As Long

np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 0, 950, 550, 1) ' Application.hwnd ' X Y largeur hauteur

np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 0, 950, 550, 1) ' Application.hwnd ' X Y largeur hauteur

np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 550, 950, 550, 1) ' Application.hwnd ' X Y largeur hauteur

np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 550, 950, 550, 1) ' Application.hwnd ' X Y largeur hauteur

End Sub

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Function ProcIDFromWnd(ByVal hwnd As Long) As Long
Dim idProc As Long

' Get PID for this HWnd
GetWindowThreadProcessId hwnd, idProc
ProcIDFromWnd = idProc

End Function

Function GetWinHandle(hInstance As Long) As Long
Dim tempHwnd As Long

' Grab the first window handle that Windows finds:
tempHwnd = FindWindow(vbNullString, vbNullString)

' Loop until you find a match or there are no more window handles:
Do Until tempHwnd = 0
' Check if no parent for this window
If GetParent(tempHwnd) = 0 Then
' Check for PID match
If hInstance = ProcIDFromWnd(tempHwnd) Then
' Return found handle
GetWinHandle = tempHwnd
' Exit search loop
Exit Do
End If
End If

' Get the next window handle
tempHwnd = GetWindow(tempHwnd, GW_HWNDNEXT)
Loop
End Function
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

10 réponses

1 2
Avatar
Michd
Bonjour,
Voici un fichier exemple qui fait le travail.
'Prends le temps de lire les commentaires dans le code.
'Cela peut te donner des idées...
https://www.cjoint.com/c/HFwo3Tuuh4i
Le code que tu as publié devrait fonctionner... cependant pour une raison que j'ignore, cette
section du code "GetWinHandle(np_retval)" dans la ligne de code suivante "retval =
MoveWindow(GetWinHandle(np_retval), 0, 0, 950, 550, 1)" ne retourne pas les "Handle" de la fenêtre
dans le cas de l'explorateur Windows. Sa valeur est 0. Conséquemment, la position de la fenêtre
n'est pas exécutée.
Si tu trouves l'explication ou une autre manière de procéder, je suis preneur!
P.S. Même les amis d'Excel 2003 devait pouvoir utiliser le fichier.
MichD
"29Eric29" a écrit dans le message de groupe de discussion :
Bonjour,
Je cherche à ouvrir 4 fenêtres "windows explorer" en imposant leur taille et
position sur l'écran.
J'ai trouvé un code qui fonctionne parfaitement pour ouvrir "notepad.exe" (et
positionner les fenêtres en définissant leur taille) et je cherche à l'adapter
pour "explorer.exe".
https://www.experts-exchange.com/questions/28323487/MoveWindow-in-VBA-in-EXCEL.html
Je pensais que remplacer :
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
par :
np_retval = Shell("C:windowsexplorer.exe", vbNormalFocus)
suffirait....mais ça n'est pas si simple j'ai l'impression ?
Voici le code si quelqu'un avait une idée pour l'adapter à explorer.exe ?? :
Un grand merci d'avance...et bonne journée
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Option Explicit
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
Public Const GW_HWNDNEXT As Long = 2
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd
As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As
Long, lpdwprocessid As Long) As Long
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub tile1()
Dim retval As Long, np_retval As Long
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 0, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 0, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 550, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 550, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
End Sub
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Function ProcIDFromWnd(ByVal hwnd As Long) As Long
Dim idProc As Long
' Get PID for this HWnd
GetWindowThreadProcessId hwnd, idProc
ProcIDFromWnd = idProc
End Function
Function GetWinHandle(hInstance As Long) As Long
Dim tempHwnd As Long
' Grab the first window handle that Windows finds:
tempHwnd = FindWindow(vbNullString, vbNullString)
' Loop until you find a match or there are no more window handles:
Do Until tempHwnd = 0
' Check if no parent for this window
If GetParent(tempHwnd) = 0 Then
' Check for PID match
If hInstance = ProcIDFromWnd(tempHwnd) Then
' Return found handle
GetWinHandle = tempHwnd
' Exit search loop
Exit Do
End If
End If
' Get the next window handle
tempHwnd = GetWindow(tempHwnd, GW_HWNDNEXT)
Loop
End Function
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Avatar
Michd
Sur mon ordinateur, je peux utiliser un délai d'une seule seconde
à la ligne de code T = Timer + 1 et cela fonctionne très bien.
MichD
Avatar
29eric29
Le vendredi 22 Juin 2018 à 10:33 par 29Eric29 :
Bonjour,
Je cherche à ouvrir 4 fenêtres "windows explorer" en
imposant leur taille et position sur l'écran.
J'ai trouvé un code qui fonctionne parfaitement pour ouvrir
"notepad.exe" (et positionner les fenêtres en
définissant leur taille) et je cherche à l'adapter pour
"explorer.exe".
https://www.experts-exchange.com/questions/28323487/MoveWindow-in-VBA-in-EXCEL.html
Je pensais que remplacer :
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
par :
np_retval = Shell("C:windowsexplorer.exe", vbNormalFocus)
suffirait....mais ça n'est pas si simple j'ai l'impression ?
Voici le code si quelqu'un avait une idée pour l'adapter à
explorer.exe ?? :
Un grand merci d'avance...et bonne journée
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Option Explicit
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
Public Const GW_HWNDNEXT As Long = 2
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long)
As Long
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long,
ByVal wCmd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias
"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As
String) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal
hwnd As Long, lpdwprocessid As Long) As Long
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub tile1()
Dim retval As Long, np_retval As Long
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 0, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 0, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 550, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 550, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
End Sub
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Function ProcIDFromWnd(ByVal hwnd As Long) As Long
Dim idProc As Long
' Get PID for this HWnd
GetWindowThreadProcessId hwnd, idProc
ProcIDFromWnd = idProc
End Function
Function GetWinHandle(hInstance As Long) As Long
Dim tempHwnd As Long
' Grab the first window handle that Windows finds:
tempHwnd = FindWindow(vbNullString, vbNullString)
' Loop until you find a match or there are no more window handles:
Do Until tempHwnd = 0
' Check if no parent for this window
If GetParent(tempHwnd) = 0 Then
' Check for PID match
If hInstance = ProcIDFromWnd(tempHwnd) Then
' Return found handle
GetWinHandle = tempHwnd
' Exit search loop
Exit Do
End If
End If
' Get the next window handle
tempHwnd = GetWindow(tempHwnd, GW_HWNDNEXT)
Loop
End Function
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Bonjour,
J'imagine que ça marche ! Le problème c'est que j'ai un 64bits pour le week-end (Grrrr !)..et donc ça ne fonctionne pas !
Je vais creuser pour l'adapter...
Un grand merci pour ce coup de main....
Vivement demain que je teste sur mon ordi 32bits.
Je vous tiens au courant !
Bonne journée
Avatar
Michd
| J'imagine que ça marche ! Le problème c'est que j'ai un 64bits pour le week-end
| (Grrrr !)..et donc ça ne fonctionne pas !
J'ai testé ceci sur mon ordi 64 bits, Windows 10 version 1703 et Microsoft Office 2016. Cela
fonctionne très bien. En théorie, cela devrait marcher sur un 32 bits bien que je n'ai pas testé cet
environnement. As-tu un message d'erreur? Si oui, lequel? Quelle ligne de code est mise en
surbrillance lorsque la macro s'arrête durant l'exécution?
MichD
Avatar
Michd
2 Choses à surveiller :
A ) Exécute le raccourci suivant : Win + E cela ouvre l'explorateur Windows. Dans la fenêtre de
l'explorateur Windows, quel est le texte inscrit dans la barre de titre? La procédure utilise
""Explorateur de fichiers". Si tu as autre chose, tu dois adapter cette ligne de code "NomFenetre =
"Explorateur de fichiers" selon le texte de la barre de titre.
B ) La procédure utilise une temporisation afin de permettre la finalisation de la création de 4
instances de la fenêtre "Explorateur Windows". Chez moi, une seconde est suffisante. Cela pourrait
être plus selon la puissance de l'ordinateur. Au besoin, il faut adapter cette ligne de code:
T = Timer + 1 'le 1 représente une seconde.
Do While T >= Timer
DoEvents
Loop
MichD
Avatar
29eric29
Le vendredi 22 Juin 2018 à 10:33 par 29Eric29 :
Bonjour,
Je cherche à ouvrir 4 fenêtres "windows explorer" en
imposant leur taille et position sur l'écran.
J'ai trouvé un code qui fonctionne parfaitement pour ouvrir
"notepad.exe" (et positionner les fenêtres en
définissant leur taille) et je cherche à l'adapter pour
"explorer.exe".
https://www.experts-exchange.com/questions/28323487/MoveWindow-in-VBA-in-EXCEL.html
Je pensais que remplacer :
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
par :
np_retval = Shell("C:windowsexplorer.exe", vbNormalFocus)
suffirait....mais ça n'est pas si simple j'ai l'impression ?
Voici le code si quelqu'un avait une idée pour l'adapter à
explorer.exe ?? :
Un grand merci d'avance...et bonne journée
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Option Explicit
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
Public Const GW_HWNDNEXT As Long = 2
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long)
As Long
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long,
ByVal wCmd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias
"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As
String) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal
hwnd As Long, lpdwprocessid As Long) As Long
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub tile1()
Dim retval As Long, np_retval As Long
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 0, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 0, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 550, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 550, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
End Sub
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Function ProcIDFromWnd(ByVal hwnd As Long) As Long
Dim idProc As Long
' Get PID for this HWnd
GetWindowThreadProcessId hwnd, idProc
ProcIDFromWnd = idProc
End Function
Function GetWinHandle(hInstance As Long) As Long
Dim tempHwnd As Long
' Grab the first window handle that Windows finds:
tempHwnd = FindWindow(vbNullString, vbNullString)
' Loop until you find a match or there are no more window handles:
Do Until tempHwnd = 0
' Check if no parent for this window
If GetParent(tempHwnd) = 0 Then
' Check for PID match
If hInstance = ProcIDFromWnd(tempHwnd) Then
' Return found handle
GetWinHandle = tempHwnd
' Exit search loop
Exit Do
End If
End If
' Get the next window handle
tempHwnd = GetWindow(tempHwnd, GW_HWNDNEXT)
Loop
End Function
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Bonjour,
Dans la fenêtre de l'explorateur windows il n'y a "rien du tout d'écrit "...
En fait je suis sous win7 SP1 pro 64 bits....
Ceci explique t-il cela ?
Une idée ?
D'avance merci
Bonne journée
Eric
Avatar
29eric29
Le vendredi 22 Juin 2018 à 10:33 par 29Eric29 :
Bonjour,
Je cherche à ouvrir 4 fenêtres "windows explorer" en
imposant leur taille et position sur l'écran.
J'ai trouvé un code qui fonctionne parfaitement pour ouvrir
"notepad.exe" (et positionner les fenêtres en
définissant leur taille) et je cherche à l'adapter pour
"explorer.exe".
https://www.experts-exchange.com/questions/28323487/MoveWindow-in-VBA-in-EXCEL.html
Je pensais que remplacer :
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
par :
np_retval = Shell("C:windowsexplorer.exe", vbNormalFocus)
suffirait....mais ça n'est pas si simple j'ai l'impression ?
Voici le code si quelqu'un avait une idée pour l'adapter à
explorer.exe ?? :
Un grand merci d'avance...et bonne journée
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Option Explicit
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
Public Const GW_HWNDNEXT As Long = 2
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long)
As Long
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long,
ByVal wCmd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias
"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As
String) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal
hwnd As Long, lpdwprocessid As Long) As Long
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub tile1()
Dim retval As Long, np_retval As Long
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 0, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 0, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 950, 550, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
np_retval = Shell("C:windowsnotepad.exe", vbNormalFocus)
retval = MoveWindow(GetWinHandle(np_retval), 0, 550, 950, 550, 1) '
Application.hwnd ' X Y largeur hauteur
End Sub
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Function ProcIDFromWnd(ByVal hwnd As Long) As Long
Dim idProc As Long
' Get PID for this HWnd
GetWindowThreadProcessId hwnd, idProc
ProcIDFromWnd = idProc
End Function
Function GetWinHandle(hInstance As Long) As Long
Dim tempHwnd As Long
' Grab the first window handle that Windows finds:
tempHwnd = FindWindow(vbNullString, vbNullString)
' Loop until you find a match or there are no more window handles:
Do Until tempHwnd = 0
' Check if no parent for this window
If GetParent(tempHwnd) = 0 Then
' Check for PID match
If hInstance = ProcIDFromWnd(tempHwnd) Then
' Return found handle
GetWinHandle = tempHwnd
' Exit search loop
Exit Do
End If
End If
' Get the next window handle
tempHwnd = GetWindow(tempHwnd, GW_HWNDNEXT)
Loop
End Function
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Cerise sur le gâteau "Aucun message d'erreur" pour me guider !
Les 4 fenêtres s'ouvrent...mais dans la "dernière position de fermeture".
Gloups...
Avatar
Michd
https://www.cjoint.com/c/HFzk3Zxs7Ii
Voici une image de "l'explorateur de fichiers" sur Windows 10 et son appellation dans la barre de
titre "Explorateur de fichiers" lorsque la fenêtre s'ouvre par la procédure. Pour que la procédure
fonctionne, l'expression de la barre de titre est nécessaire et essentielle à la procédure sans
cela, le positionnement des fenêtres ne s'exécute pas correctement. La procédure que tu as publiée
se retrouve sur le "Web" et c'est celle qui est recommandée... et elle a déjà fonctionné même avec
l'explorateur de fichiers par le passé. Pour l'instant, je n'ai pas d'autre alternative à te
proposer.
MichD
Avatar
Michd
À cette adresse https://docs.microsoft.com/en-us/sysinternals/downloads/handle il y a un petit
programme "Handle v4.11" (310 Ko) que tu peux télécharger pour obtenir le hwnd d'une fenêtre en
utilisant l'un des paramètres. Perso., je n'ai jamais utilisé ce programme.
MichD
Avatar
Michel__D
Bonjour,
Le 25/06/2018 à 08:26, 29eric29 a écrit :
Le vendredi 22 Juin 2018 à 10:33 par 29Eric29 :
Bonjour,
Je cherche à ouvrir 4 fenêtres "windows explorer" en
imposant leur taille et position sur l'écran.


Essaye avec le code ci-dessous (je n'ai pas testé) :
' Début
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
Sub Depart()
Dim oSHA As Object, oWnd As Object
Dim iK As Long, ndT As Double
' ouverture des 4 fenêtres de l'explorateur windows
For iK = 1 To 4
Shell "C:windowsSystem32explorer.exe", vbNormalFocus
Next
ndT = Timer + 1
Do While ndT >= Timer
DoEvents
Loop
iK = 0
asV = Split("0,0,950,550,950,0,950,550,950,550,950,550,0,550,950,550", ",")
Set oSHA = CreateObject("Shell.Application")
For Each oWnd In oSHA.Windows
If Left(TypeName(oWnd.Document),12)="IShellFolder" Then
MoveWindow oWnd.HWND,CLng(asV(iK)),CLng(asV(iK + 1)),CLng(asV(iK + 2)),CLng(asV(iK + 3)),1
iK = iK + 4
End If
If iK > 15 Then Exit For ' 4 Fenêtres
Next
Set oWnd=Nothing
Set oSHA=Nothing
End Sub
' Fin
1 2