-
Jan 3rd, 2021, 06:20 PM
#1
[RESOLVED] Getting hWnd from VBIDE.Window
Hi folks...
I'm in the process of writing (well, playing around, more like) an IDE addin, and I'd like to know if there's an easy way of getting the hWnd of a VBIDE.Window object.
Anybody know how to do this?
I stumbled across these;
Private Declare Function WindowFromAccessibleObject Lib "oleacc" (ByVal pacc As IAccessible, pHwnd As Long) As Long
Private Declare Function IUnknown_GetWindow Lib "shlwapi" Alias "#172" (ByVal pIUnk As IUnknown, ByVal hwnd As Long) As Long
as a supposed way of getting the hWnd of a VBA Userform, but had no luck in applying this technique to my situation.
Ideas?
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 3rd, 2021, 10:35 PM
#2
Re: Getting hWnd from VBIDE.Window
In the add-in:
Code:
Dim c As Long
For c = 1 To VBInstance.Windows.Count
Debug.Print VBInstance.Windows(c).hWnd
Next
VBInstance is the object variable set in the AddinInstance_OnConnection procedure of the default add-in code.
-
Jan 4th, 2021, 04:57 AM
#3
Re: Getting hWnd from VBIDE.Window
That's the first thing I tried, having read that .hWnd is a 'hidden' property of the Window object. But the hWnd's are all reported as 0. My code (inside my UserDocument):
Code:
Dim W As VBIDE.Window
For Each W In gVBInstance.Windows
If W.Visible Then
Select Case W.Type
Case vbext_wt_CodeWindow
'blah blah
Case vbext_wt_Designer
'blah blah
Case vbext_wt_Browser 'Object Browser
'blah blah
Case Else
'blah blah
End Select
Debug.Print W.hWnd, W.Caption
End If
Next W
All the expected windows are there, by the way, as evidenced by the W.Captions
Last edited by ColinE66; Jan 4th, 2021 at 05:14 AM.
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 4th, 2021, 05:12 AM
#4
Re: Getting hWnd from VBIDE.Window
you can download the sources from VBIDEUtils, it can inspire you
-
Jan 4th, 2021, 05:22 AM
#5
Re: Getting hWnd from VBIDE.Window
Originally Posted by Thierry69
you can download the sources from VBIDEUtils, it can inspire you
Hi Thierry, I already looked through all the Add-In code I could find, and did not encounter a method for doing this...
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 4th, 2021, 05:39 AM
#6
Re: Getting hWnd from VBIDE.Window
Further info....
Debug.print gVBInstance.MainWindow.hWnd - returns a non-zero value
Debug.print gVBInstance.ActiveWindow.hWnd - returns zero
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 4th, 2021, 07:52 AM
#7
Re: Getting hWnd from VBIDE.Window
using EnumChildWindows from the top level IDE window yielded the attached images below, then enuming the children of
a VBAWindow yielded some more hwnds but nothing of a separate embedded edit type control.
I guess this means the code window edit control is custom drawn directly on the form hdc ?
I have not had any luck sending messages to the code windows. I tried standard edit and rtf messages
which did not seem to be honored.
The closest I came was the ability to clear the immediate window. (Not 100% reliable
I have had it blank out a code window on rare occasion.)
Code:
Sub ClearImmediateWindow()
On Error Resume Next
Dim oWindow As VBIDE.Window
Set oWindow = VBInstance.ActiveWindow
VBInstance.Windows("Immediate").SetFocus
SendKeys "^{Home}", True
SendKeys "^+{End}", True
SendKeys "{Del}", True
oWindow.SetFocus
End Sub
Sub SetImmediateText(text As String)
On Error Resume Next
Dim oWindow As VBIDE.Window
Dim saved As String
Dim s As Date
If Len(text) = 0 Then Exit Sub
ClearImmediateWindow
Clipboard.Clear
Clipboard.SetText text
VBInstance.Windows("Immediate").SetFocus
SendKeys "^v", False 'True
end sub
Last edited by dz32; Jan 4th, 2021 at 08:35 AM.
-
Jan 4th, 2021, 08:27 AM
#8
Re: Getting hWnd from VBIDE.Window
Thanks dz, but I was hoping to avoid that kind of approach, in case of window-name collisions, and the potential for captions being different under different language settings...
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 4th, 2021, 09:41 AM
#9
Re: Getting hWnd from VBIDE.Window
Originally Posted by ColinE66
But the hWnd's are all reported as 0.
I see.
-
Jan 4th, 2021, 11:31 AM
#10
Re: Getting hWnd from VBIDE.Window
step 1 find the handle somehow
step 2 make sure you can do something useful with it
second part has not been as expected.
-
Jan 8th, 2021, 08:20 PM
#11
Re: Getting hWnd from VBIDE.Window
Code:
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd 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 IsWindowVisible Lib "user32" (ByVal hWnd As Long) As Long
Dim WindowhWnd As Long
Dim Buff As String * 255
Dim DeskTophWnd As Long
DeskTophWnd = VBInstance.MainWindow.hWnd
WindowhWnd = GetWindow(DeskTophWnd, 5)
Do While (WindowhWnd <> 0)
GetWindowText WindowhWnd, Buff, 255
If (Trim(Buff) <> "") And (IsWindowVisible(WindowhWnd) > False) Then
MsgBox WindowhWnd, , Buff
End If
WindowhWnd = GetWindow(WindowhWnd, 2)
Debug.Print WindowhWnd
Loop
Some untitled windows appear.
www.vbforums.com/showthread.php?866639-RESOLVED-Get-List-Of-All-Visible-Windows-WinTitle-and-Hwnd
Last edited by Episcopal; Jan 8th, 2021 at 08:25 PM.
-
Jan 10th, 2021, 10:18 AM
#12
Re: Getting hWnd from VBIDE.Window
Hi Episcopal,
Yes, that's one way, of course, but I was wondering if it was possible to do it without looping through all the windows. Thanks for taking an interest, anyway...
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 21st, 2021, 07:11 AM
#13
Re: Getting hWnd from VBIDE.Window
I don't know if it will work with different windows:
Code:
Dim cWnd As Window
Dim hWnd As Long
On Error GoTo error_handler
'save the vb instance
Set VBInstance = Application
For Each cWnd In VBInstance.Windows
GetMem4 ByVal ObjPtr(cWnd) + &H1C, hWnd
MsgBox cWnd.Caption & " hwnd: " & Hex(hWnd)
Next
It works only inside compiled code.
-
Jan 21st, 2021, 08:02 AM
#14
Re: Getting hWnd from VBIDE.Window
Awesome. Thanks so much...
I did have a try using GetMem4, but couldn't get it working. Then again, I didn't have that + &H1C. What is that for?
Thanks, again...
EDIT: Actually, thinking about it, I didn't try my PutMem4 code compiled, so it would never have worked anyway!
Last edited by ColinE66; Jan 21st, 2021 at 08:05 AM.
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 21st, 2021, 08:07 AM
#15
Re: Getting hWnd from VBIDE.Window
Originally Posted by ColinE66
Then again, I didn't have that + &H1C. What is that for?
It's the secret sauce! :-))
Otherwise you could use CopyMemory API to access Window object's internal state as well -- makes no difference.
cheers,
</wqw>
-
Jan 21st, 2021, 08:15 AM
#16
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Aah, secret sauce. Of course. From now on, whenever I encounter any bugs in my programs, I'll just throw-in an &H1C.
EDIT: Actually, &H2A seems more appropriate.
Last edited by ColinE66; Jan 21st, 2021 at 08:21 AM.
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 21st, 2021, 08:36 AM
#17
Re: Getting hWnd from VBIDE.Window
Originally Posted by ColinE66
Then again, I didn't have that + &H1C. What is that for?
A window object has the hidden hWnd property:
The problem is it seems work only for vbext_wt_MainWindow windows. So i just check how does this method work:
You can see the 0x1C offset which contains the window handle.
-
Jan 21st, 2021, 08:53 AM
#18
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Thanks for posting the explanation; do you have any similar insights into how to get the icons for those windows as all of the usual approaches fail. Or am I pushing my luck? Currently, I am just getting the icon associated with the file type that the VBWindow represents, which works, but it feels like there should be a better way...
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 21st, 2021, 11:30 AM
#19
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by ColinE66
Thanks for posting the explanation; do you have any similar insights into how to get the icons for those windows as all of the usual approaches fail. Or am I pushing my luck? Currently, I am just getting the icon associated with the file type that the VBWindow represents, which works, but it feels like there should be a better way...
Please attach a small example what you're trying to obtain.
-
Jan 21st, 2021, 11:58 AM
#20
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Hi again trick,
The problem is, that the usual approaches like
hIcon=SendMessage(hWnd, WM_GETICON, 0, 0)
hIcon=GetClassLong(hwnd, GCL_HICONSM)
all return 0 for the VBIDE windows and WinSpy confirms that there is no icon available for those hWnd's. And yet, there they are, visible in the top left corner!
Because I cannot currently get these icons, my addin code is using the ones that relate to the VBComponent type; so, for example, if it's a Class module, I am using the icon associated with the .cls extension, which I obtain via SHGetFileInfo.
But I'd really prefer to get the icon that the IDE is displaying, if I can. I was wondering if, perhaps, the icon handles are 'hidden' (like the hWnd's are), and that you could tell me the 'magic' offset?
Thanks...
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 24th, 2021, 02:59 PM
#21
Re: [RESOLVED] Getting hWnd from VBIDE.Window
My bad. I can actually get the icons via SendMessage(hWnd, WM_GETICON, ICON_SMALL, 0&)
Don't know what stupidity I was possessed by when I first tried, but I had another go and it worked just fine...
This thread is well and truly resolved.
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 24th, 2021, 06:53 PM
#22
Re: [RESOLVED] Getting hWnd from VBIDE.Window
form1.caption="123123456"hwnd=findwindow(123123456,like this)
-
Jan 24th, 2021, 09:36 PM
#23
Re: [RESOLVED] Getting hWnd from VBIDE.Window
And what if I have two projects open, as a Project Group, and they each have a form with the same caption?
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 02:02 AM
#24
Re: [RESOLVED] Getting hWnd from VBIDE.Window
title=form1.caption
Form1.caption=“123123456”
hwnd=findWindow(123123456
form1.caption=title
-
Jan 25th, 2021, 07:25 AM
#25
Re: [RESOLVED] Getting hWnd from VBIDE.Window
I don't think you understand the problem. Imagine there were two identical forms on your screen, with the same caption, and the user clicked one. Which one did he click?
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 07:30 AM
#26
Re: [RESOLVED] Getting hWnd from VBIDE.Window
The idea of xiaoyao's code is that if Caption property is writable then you can temporaty change the Caption to a unique string (a GUID) then use FindWindow API to locate the hWnd before restoring the original Caption.
Super hacky but can be used as a last resort until anything better comes up.
cheers,
</wqw.
-
Jan 25th, 2021, 07:55 AM
#27
Re: [RESOLVED] Getting hWnd from VBIDE.Window
you can save vba forms hwnd in ini file ,when forms load.
so findwindow ,will get 2 hwnd,you will khnow what form from ini file
-
Jan 25th, 2021, 08:50 AM
#28
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by xiaoyao
you can save vba forms hwnd in ini file ,when forms load.
so findwindow ,will get 2 hwnd,you will khnow what form from ini file
Hence the question: How do I get the hWnd of a vba window!
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 08:55 AM
#29
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by wqweto
The idea of xiaoyao's code is that if Caption property is writable then you can temporaty change the Caption to a unique string (a GUID) then use FindWindow API to locate the hWnd before restoring the original Caption.
Super hacky but can be used as a last resort until anything better comes up.
cheers,
</wqw.
Yes, I guess that would work (but is horrible!). But my example was actually a poor illustration of what I'm actually doing. My addin is a tabstrip, and the user could be clicking on a tab, rather than a window. In that case, I need to know which code pane or designer window corresponds to that tab, so that I can send it an activate message.
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 09:16 AM
#30
Re: [RESOLVED] Getting hWnd from VBIDE.Window
get hwnd :vba code in excel forms:
Code:
Dim MyHwnd As Long
Private Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub UserForm_Initialize()
Dim OldCaption As String
Dim NewCaption As String
NewCaption = "nowTime:" & Now
OldCaption = Me.Caption
Me.Caption = NewCaption
MyHwnd = FindWindowA(vbNullString, NewCaption)
Me.Caption = OldCaption & ",hwnd=" & MyHwnd
End Sub
code 2:
Code:
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
Private Declare Function CoCreateGuid Lib "ole32.dll" (G As GUID) As Long
Private Declare Function StringFromGUID2 Lib "ole32.dll" (G As GUID, _
ByVal str As String, _
ByVal cchMax As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Function GetGUID() As String
Dim G As GUID
Dim S As String
S = String(76, vbNullChar)
CoCreateGuid G
StringFromGUID2 G, S, Len(S)
S = StrConv(S, vbFromUnicode)
GetGUID = S
End Function
Private Function GetUserFormHandle(ByVal UF As Object)
Dim S As String
Dim OrigCaption As String
S = GetGUID()
OrigCaption = UF.Caption
UF.Caption = S
GetUserFormHandle = FindWindow(vbNullString, S)
UF.Caption = OrigCaption
End Function
Private Sub Label1_Click()
End Sub
Private Sub UserForm_Initialize()
Dim MyHwnd As Long
MyHwnd = GetUserFormHandle(Me)
Me.Caption = "Window handle:" & MyHwnd & ",Hex:0x" + Hex(MyHwnd)
End Sub
code 3:
Code:
Private Declare Function IUnknown_GetWindow Lib "shlwapi.dll" (ByVal punk As IUnknown, ByRef phwnd As Long) As Long
Function GetHwnd_Com() As Long
IUnknown_GetWindow Me, GetHwnd_Com
End Function
code 4
Code:
Private Declare Function IUnknown_GetWindow Lib "shlwapi.dll" (ByVal punk As IUnknown, ByRef phwnd As Long) As Long
Private Declare PtrSafe Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare PtrSafe Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Function GetWinText(Hwnd1 As Long) As String
Dim s As String
Dim TextLen As Long
s = String(255, 0) '
TextLen = GetWindowTextLength(Hwnd1) '
GetWindowText Hwnd1, s, 256
GetWinText = Left(s, TextLen) '
End Function
Sub ListAllUserFormsHwnd()
Dim MyHwnd As Long
Dim f As UserForm
For Each f In UserForms
IUnknown_GetWindow f, MyHwnd
MsgBox "MyHwnd=" & MyHwnd & ",caption=" & GetWinText(myhwnd)
Next
Last edited by xiaoyao; Jan 25th, 2021 at 10:35 AM.
-
Jan 25th, 2021, 09:26 AM
#31
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by xiaoyao
get hwnd :vba code in excel forms:
Code:
Dim MyHwnd As Long
Private Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub UserForm_Initialize()
Dim OldCaption As String
Dim NewCaption As String
NewCaption = "nowTime:" & Now
OldCaption = Me.Caption
Me.Caption = NewCaption
MyHwnd = FindWindowA(vbNullString, NewCaption)
Me.Caption = OldCaption & ",hwnd=" & MyHwnd
End Sub
Yes, I get it, thanks - I just don't like it very much! Trick's solution is much better for my situation. Thanks for posting, though...
By the way, a VBIDE.Window's caption is read-only, according to the Object Browser...
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 09:27 AM
#32
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by xiaoyao
code 2:
Code:
Private Sub UserForm_Initialize()
Me.Caption = Me.Caption & ",hwnd=" & Application.ActiveWindow.Hwnd
End Sub
Application.ActiveWindow.Hwnd returns 0. See post #6
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 09:45 AM
#33
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by ColinE66
By the way, a VBIDE.Window's caption is read-only
Ooops, scratch this alt solution then.
cheers,
</wqw>
-
Jan 25th, 2021, 10:02 AM
#34
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by wqweto
Ooops, scratch this alt solution then.
cheers,
</wqw>
Even if that property was writable, my addin works whilst in Run and Break mode and, at that point, you'd definitely get a Permission Denied error if using that technique. Even Trick's solution has that problem.
I've given up on using the IDE Object model for that reason. Right now, I'm enumerating all the child windows of the MDI window (for MDI mode), and the relvant window classes for SDI mode.
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 10:03 AM
#35
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Code:
Private Declare Function IUnknown_GetWindow Lib "shlwapi.dll" (ByVal punk As IUnknown, ByRef phwnd As Long) As Long
Function GetHwnd_Com() As Long
IUnknown_GetWindow Me, GetHwnd_Com
'IUnknown_GetWindow userform1, GetHwnd_Com
'IUnknown_GetWindow userform2, GetHwnd_Com
End Function
Last edited by xiaoyao; Jan 25th, 2021 at 10:08 AM.
-
Jan 25th, 2021, 10:14 AM
#36
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Isn't that more-or-less what I said I'd tried in post #1? Anyway, I tried your code, as below, and all the hWn'ds returned were 0. Did you test it before posting?
Code:
Private Declare Function IUnknown_GetWindow Lib "shlwapi.dll" (ByVal punk As IUnknown, ByRef phwnd As Long) As Long
Private Sub Command1_Click()
Dim CP As CodePane, hWnd As Long
For Each CP In gVBInstance.CodePanes
IUnknown_GetWindow CP.Window, hWnd
Debug.Print hWnd
Next CP
End Sub
Last edited by ColinE66; Jan 25th, 2021 at 10:27 AM.
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 10:24 AM
#37
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Code:
Private Declare Function IUnknown_GetWindow Lib "shlwapi.dll" (ByVal punk As IUnknown, ByRef phwnd As Long) As Long
Private Declare PtrSafe Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare PtrSafe Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Function GetWinText(Hwnd1 As Long) As String
Dim s As String
Dim TextLen As Long
s = String(255, 0) '
TextLen = GetWindowTextLength(Hwnd1) '
GetWindowText Hwnd1, s, 256
GetWinText = Left(s, TextLen) '
End Function
Sub ListAllUserFormsHwnd()
Dim MyHwnd As Long
Dim f As UserForm
For Each f In UserForms
IUnknown_GetWindow f, MyHwnd
MsgBox "MyHwnd=" & MyHwnd & ",caption=" & GetWinText(myhwnd)
Next
End Sub
Last edited by xiaoyao; Jan 25th, 2021 at 10:34 AM.
-
Jan 25th, 2021, 10:29 AM
#38
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by xiaoyao
Code:
Private Declare Function IUnknown_GetWindow Lib "shlwapi.dll" (ByVal punk As IUnknown, ByRef phwnd As Long) As Long
Sub ListAllUserFormsHwnd()
Dim MyHwnd As Long
Dim f As UserForm
For Each f In UserForms
IUnknown_GetWindow f, MyHwnd
MsgBox "MyHwnd=" & MyHwnd
Next
End Sub
I'm not intrested in UserForms; see my original question. I'm interested in VBIDE.Windows.
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 10:40 AM
#39
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Code:
Private Declare Function IUnknown_GetWindow Lib "shlwapi.dll" (ByVal punk As IUnknown, ByRef phwnd As Long) As Long
Sub ListAllUserFormsHwnd()
Dim MyHwnd As Long
Dim c As Long
For c = 1 To VBInstance.Windows.Count
' IUnknown_GetWindow VBInstance.Windows(c),MyHwnd
'msgbox "MyHwnd=" & MyHwnd
MsgBox VBInstance.Windows(c).ActivePane.Application.ActiveWindow.hwnd
Next
End Sub
Last edited by xiaoyao; Jan 25th, 2021 at 10:46 AM.
-
Jan 25th, 2021, 10:51 AM
#40
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Dim x As String
Dim vbc As VBIDE.VBComponent
For Each vbc In ThisWorkbook.VBProject.VBComponents
If vbc.Type = vbext_ct_MSForm Then
Debug.Print vbc.Name
x = x & vbCr & vbc.Name
End If
Next vbc
If x = "" Then
MsgBox "No UserForms created."
Exit Sub
End If
MsgBox x
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|