Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2005

Tip: Looking for answers? Try searching our database.

dynamic user forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary Mc - 15 Mar 2005 23:03 GMT
I am trying to create runtime text fields and then capture events on this
text field. I have experimented with several things I have found on the
internet, but have been unsuccessful. The form shows when I run it and the
text box appears, but when I click in it, I do not invoke the control event.
Any ideas?

I have a class module: MyCtrlEvents

******
Option Explicit
Public WithEvents MyBox As MSForms.TextBox

Private Sub MyBox_Click()
   MsgBox MyBox.Name & " click!"
End Sub
******

And I have a form with nothing on it. Here is the code.

******
Dim c() As MyCtrlEvents

Private Sub UserForm_Activate()

   
   ReDim c(1)
   Set c(0) = New MyCtrlEvents
 
   Set c(0).MyBox = Me.Controls.Add("Forms.Textbox.1")
   With c(0).MyBox
       .Name = "TextBoxTest"
       .Top = 42
       .Width = 72
       .Height = 18
       .Left = 20
   End With
   
End Sub
*****

Signature

Thanks,
Gary

Cindy M  -WordMVP- - 27 Mar 2005 17:05 GMT
Hi =?Utf-8?B?R2FyeSBNYw==?=,

Textbox controls in Office UserForms don't have a Click event. They have a
double-click event, and an Enter event...

When a textbox is selected, dropdown the list at the top-right of the CODE
window and you'll see the list of available events.

> I am trying to create runtime text fields and then capture events on this
> text field. I have experimented with several things I have found on the
[quoted text clipped - 9 lines]
>  
> Private Sub MyBox_Click()

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.