VBA code von office2000 für office97 abändern
12.09.2003 16:42:36
chris b
habe hier einen VBA code der in Excel 2000 funktioniert nur ich habe office 97 und muss es da auch zum laufen bringen, ich hoffe mir kann jemdand helfen den code abzuändern ? Vielen Dank schon einmal gruß Christian
Private Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam 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 IsWindowVisible& Lib "user32" (ByVal hwnd As Long)
Private Declare Function GetParent& Lib "user32" (ByVal hwnd As Long)
Dim sPattern As String, hFind As Long
Dim Anzahl
Dim Found As Boolean
Function EnumWinProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim k As Long, sName As String
stName = Space$(128)
If IsWindowVisible(hwnd) And GetParent(hwnd) = 0 Then
sName = Space$(128)
k = GetWindowText(hwnd, sName, 128)
If k > 0 Then
sName = Left$(sName, k)
If sName Like sPattern Then
hFind = hwnd
EnumWinProc = 0
Anzahl = Anzahl + 1
'ActiveSheet.Range("A" & Anzahl) = sName
Found = sName = "Unbenannt - Editor"
If Found Then Exit Function
End If
End If
End If
EnumWinProc = 1
End Function
Public Function FindWindowWild(sWild As String, Optional bMatchCase As Boolean = True) As Long
sPattern = sWild
If Not bMatchCase Then sPattern = UCase(sPattern)
EnumWindows AddressOf EnumWinProc, bMatchCase
FindWindowWild = hFind
End Function
Private Sub start()
Do
DoEvents
Call FindWindowWild("*", False)
Loop Until Found
MsgBox ("is offen")
End Sub