AW: FunctionWizard mit bestimmter Kategorie
28.02.2022 15:26:29
Mullit
Hallo,
okidoki, probier mal, ich komm leider auf die Schnelle nicht an das Combobox-Handle ran, sonst könnte man sauberer mit SendMessage was machen, also dann Oldschool mit Sendkeys...;-)
Option Explicit
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 KillTimer Lib "user32.dll" ( _
ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long
Private Declare Function FindWindowA Lib "user32.dll" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const GC_DIALOG_CLASSNAME As String = "bosa_sdm_XL9"
Private Const GC_DIALOG_CAPTION As String = "Funktion einfügen"
Public Sub test()
Call SetTimer(Application.hwnd, 0&, 20&, AddressOf Timer_Proc)
Call Application.Dialogs.Item(xlDialogFunctionWizard).Show
End Sub
Private Sub Timer_Proc(ByVal pvlngHwnd As Long, ByVal pvlngnIDEvent As Long, _
ByVal pvlnguElapse As Long, ByVal pvlnglpTimerFunc As Long)
Const FUNC_NAME As String = "l" '// hier die Anfangsbuchstaben der Func-Namen...
Dim lngHwnd As Long, lngIndex As Long
Call KillTimer(Application.hwnd, 0&)
lngHwnd = FindWindowA(GC_DIALOG_CLASSNAME, GC_DIALOG_CAPTION)
If lngHwnd <> 0 Then
For lngIndex = 1 To 2
Call SendKeys(String:="{TAB}", Wait:=False)
Next
Call SendKeys(String:=FUNC_NAME, Wait:=False)
Call SendKeys(String:="{ENTER}", Wait:=False)
End If
End Sub
VBA/HTML - CodeConverter für Office-Foren
AddIn für Excel/Word 2000-2010 - komplett in VBA geschrieben von Lukas Mosimann
Projektbetreuung durch mumpel
Code erstellt und getestet in Office 12
Gruß, Mullit