AW: Ja genau das...
02.07.2007 20:58:15
Nepumuk
Hallo Walter,
schreib das doch gleich.
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Private Declare Function KillTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long) As Long
Private Declare Function SetTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32.dll" ( _
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 Const GC_CLASSNAMEMSDIALOG = "#32770"
Private Const GC_CLASSNAMEMSEXCEL = "XLMAIN"
Private Const SWP_NOSIZE = &H1&
Private Const SWP_NOZORDER = &H4&
Private Const SWP_NOACTIVATE = &H10&
Private Const SWP_SHOWWINDOW = &H40&
Private hWnd As Long
Private hWndBox As Long
Public Sub test()
Call prcStartTimer
ThisWorkbook.SaveAs "C:\Dokumente und Einstellungen\Max Kaffl\Desktop\Mappe1.xls"
End Sub
Private Sub prcStartTimer()
hWnd = FindWindow(GC_CLASSNAMEMSEXCEL, Application.Caption)
SetTimer hWnd, 0, 100, AddressOf prcTimer
End Sub
Private Sub prcStopTimer()
KillTimer hWnd, 0
End Sub
Private Sub prcTimer(ByVal hWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long)
On Error Resume Next
hWndBox = FindWindow(GC_CLASSNAMEMSDIALOG, vbNullString)
If hWndBox <> 0 Then
Call prcStopTimer
Call prcMoveWindow
End If
End Sub
Private Sub prcMoveWindow()
Const POS_X = 100& 'Abstand von links
Const POS_Y = 500& 'Abstand von oben
Call SetWindowPos(hWndBox, 0&, POS_X, POS_Y, 0&, 0&, _
SWP_NOSIZE Or SWP_NOZORDER Or SWP_NOACTIVATE Or SWP_SHOWWINDOW)
End Sub
Gruß
Nepumuk