Thread
:
Passing Userform as an argument to a procedure
View Single Post
#
1
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.userforms
Chip Pearson
external usenet poster
Posts: 7,247
Passing Userform as an argument to a procedure
Howard,
Declare the parameter in the called function As Object or As FormName. E.g.,
Sub AAA()
BBB UserForm1
UserForm1.Show
End Sub
Sub BBB(UF As UserForm1)
UF.Caption = "this is new caption"
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Howard Kaikow" wrote in message
...
In order to access the Caption of a Userform, I am passing the Userform as
an argument to a procedure.
If I pass the Userform as an Object, then the code works as intended. If I
pass the Userform as an MSForms.Userform, the code does not work properly.
I've seen the same behavior in both Excel and Word (Office 97, 2000, and
2002, not yet tested in Office 2003).
In one case, the caption is treated as an empty string.
In the other case, the caption is displayed in the "body" of the Userform
rather than in the title bar.
See Passing Userform as an argument to a procedure (Excel and Word) at
http://www.standards.com/OhMyWord/VBABugsFeatures.html
--
http://www.standards.com/;
See Howard Kaikow's web site.
Reply With Quote
Chip Pearson
View Public Profile
Find all posts by Chip Pearson