Nur für den Fall, dass du auf der Arbeit bist und nix herunterladen darfst:
Erstelle in einer leeren Mappe eine kleine Userform mit einer Listbox, die sie ausfüllt:
Das kommt ins Userformmodul:
Option Explicit
Private Declare PtrSafe Function SetWindowPos Lib "user32.dll" ( _
ByVal hwnd As LongPtr, _
ByVal hWndInsertAfter As LongPtr, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long
Private Declare PtrSafe Function FindWindowA Lib "user32.dll" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As LongPtr
Private Const HWND_TOPMOST As LongPtr = -1
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_NOMOVE As Long = &H2
Private Const GC_CLASSNAMEUSERFORM As String = "ThunderDFrame"
Private Sub ListBox1_Click()
Workbooks(ListBox1.Value).Activate
End Sub
Private Sub UserForm_Activate()
Dim lngptrHwnd As LongPtr
lngptrHwnd = FindWindowA(GC_CLASSNAMEUSERFORM, Caption)
Call SetWindowPos(lngptrHwnd, HWND_TOPMOST, _
0&, 0&, 0&, 0&, SWP_NOMOVE Or SWP_NOSIZE)
End Sub
Private Sub UserForm_Initialize()
Dim wb As Workbook
ListBox1.Clear
For Each wb In Workbooks
If wb.Name <> ThisWorkbook.Name And wb.Name <> "PERSONAL.XLSB" Then ListBox1.AddItem wb.Name
Next wb
End Sub
DAS kommt ins Modul der ArbeitsMAPPE:
Option Explicit
Private Sub Workbook_Open()
ActiveWindow.WindowState = xlMinimized
UserForm1.Show vbModeless
Call Tim
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
TimSto
End Sub
Und DAS in ein neues Standardmodul:
Option Explicit
Public TiZ As Double
Public Sub TimSto()
Application.OnTime TiZ, "Tim", , False
End Sub
Public Sub Tim()
Dim wb As Workbook
UserForm1.ListBox1.Clear
For Each wb In Workbooks
If wb.Name <> ThisWorkbook.Name And wb.Name <> "PERSONAL.XLSB" Then
UserForm1.ListBox1.AddItem wb.Name
End If
Next wb
TiZ = Now + TimeValue("00:00:05")
Application.OnTime TiZ, "Tim"
End Sub
Das Makro startet von selbst, sobald die Datei geöffnet wird.
Bei Problemen - melde dich einfach.
Bitte noch das ins Modul der Userform:
Private Sub UserForm_Terminate()
TimSto
ThisWorkbook.Close
End Sub
Erstelle in einer leeren Mappe eine kleine Userform mit einer Listbox, die sie ausfüllt:
Das kommt ins Userformmodul:
Option Explicit
Private Declare PtrSafe Function SetWindowPos Lib "user32.dll" ( _
ByVal hwnd As LongPtr, _
ByVal hWndInsertAfter As LongPtr, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long
Private Declare PtrSafe Function FindWindowA Lib "user32.dll" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As LongPtr
Private Const HWND_TOPMOST As LongPtr = -1
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_NOMOVE As Long = &H2
Private Const GC_CLASSNAMEUSERFORM As String = "ThunderDFrame"
Private Sub ListBox1_Click()
Workbooks(ListBox1.Value).Activate
End Sub
Private Sub UserForm_Activate()
Dim lngptrHwnd As LongPtr
lngptrHwnd = FindWindowA(GC_CLASSNAMEUSERFORM, Caption)
Call SetWindowPos(lngptrHwnd, HWND_TOPMOST, _
0&, 0&, 0&, 0&, SWP_NOMOVE Or SWP_NOSIZE)
End Sub
Private Sub UserForm_Initialize()
Dim wb As Workbook
ListBox1.Clear
For Each wb In Workbooks
If wb.Name <> ThisWorkbook.Name And wb.Name <> "PERSONAL.XLSB" Then ListBox1.AddItem wb.Name
Next wb
End Sub
DAS kommt ins Modul der ArbeitsMAPPE:
Option Explicit
Private Sub Workbook_Open()
ActiveWindow.WindowState = xlMinimized
UserForm1.Show vbModeless
Call Tim
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
TimSto
End Sub
Und DAS in ein neues Standardmodul:
Option Explicit
Public TiZ As Double
Public Sub TimSto()
Application.OnTime TiZ, "Tim", , False
End Sub
Public Sub Tim()
Dim wb As Workbook
UserForm1.ListBox1.Clear
For Each wb In Workbooks
If wb.Name <> ThisWorkbook.Name And wb.Name <> "PERSONAL.XLSB" Then
UserForm1.ListBox1.AddItem wb.Name
End If
Next wb
TiZ = Now + TimeValue("00:00:05")
Application.OnTime TiZ, "Tim"
End Sub
Das Makro startet von selbst, sobald die Datei geöffnet wird.
Bei Problemen - melde dich einfach.
Bitte noch das ins Modul der Userform:
Private Sub UserForm_Terminate()
TimSto
ThisWorkbook.Close
End Sub