Mit etwas API...
15.11.2016 11:31:46
Case
Hallo Michael, :-)
... wenn du die Datei, die du mit dem Dateidialog öffnest in der Größe verändern willst: ;-)
Option Explicit
' Quelle - http://support.microsoft.com/ _
kb/147659/en-us/
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId _
Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function MoveWindow Lib "user32.dll" _
(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 GetWindow Lib "user32" (ByVal hwnd As Long, _
ByVal wCmd As Long) As Long
Const GW_HWNDNEXT = 2
Public Sub Main()
Dim varFile As Variant
Dim hWindow As Long
varFile = Application.GetOpenFilename("Export (*.txt), *.txt,Export (*.xls*), *.xls*", _
, "Öffnen des Exports ?.xlsx")
If Not varFile = False Then
Workbooks.Open varFile
hWindow = SearchHndByWndName_Parent(Mid(varFile, InStrRev(varFile, "\", -1) + 1))
MoveWindow hWindow, 10, 20, 600, 800, &HF
End If
End Sub
Private Function SearchHndByWndName_Parent(ByVal strSearch As String) As Long
Dim strTMP As String * 100
Dim nhWnd As Long
nhWnd = FindWindow(vbNullString, vbNullString)
Do While Not nhWnd = 0
If GetParent(nhWnd) = 0 Then
GetWindowText nhWnd, strTMP, 100
If InStr(strTMP, strSearch) > 0 Then
SearchHndByWndName_Parent = nhWnd
Exit Do
End If
End If
nhWnd = GetWindow(nhWnd, GW_HWNDNEXT)
Loop
End Function
Servus
Case