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 text fields and events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary Mc - 14 Mar 2005 16:21 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
Replied to this question in another group (probably
vba.userforms). There is no click event for a textbox
control...

   Cindy Meister
 
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.