Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Get control of a Userform by the Name

I want to change the text of a form.
I know the name of the form and the name of the control in it.

How to get the control of a form if I know the Name?

Below post refers to adding a form. But I already have a form, just
need the control of that!
http://groups.google.co.in/group/mic... 993ded867dd4

Thanks a lot in advance

Regards'
Joe
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Get control of a Userform by the Name


If you are talking about a VBA user from in VBA window press F4 (View
properties window) and click on the control. The name will be in the
Name property.

If you have a worksheet user form you should be able to click on the
object and the name will be in the box next to the formula box (fx)


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=204280

http://www.thecodecage.com/forumz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Get control of a Userform by the Name

But I need it in runtime !
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Get control of a Userform by the Name

On May 21, 4:28*pm, Joe wrote:
I want to change the text of a form.
I know the name of the form and the name of the control in it.

How to get the control of a form if I know the Name?

Below post refers to adding a form. But I already have a form, just
need the control of that!http://groups.google.co.in/group/mic....programming/b...

Thanks a lot in advance

Regards'
Joe


I got a very Nice Link...
http://www.cpearson.com/excel/ShowAnyForm.htm

I am trying it out...
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Get control of a Userform by the Name

Your description is somewhat confusing... can you give more detail about
what you are actually trying to do?

--
Rick (MVP - Excel)



"Joe" wrote in message
...
I want to change the text of a form.
I know the name of the form and the name of the control in it.

How to get the control of a form if I know the Name?

Below post refers to adding a form. But I already have a form, just
need the control of that!
http://groups.google.co.in/group/mic... 993ded867dd4

Thanks a lot in advance

Regards'
Joe




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Get control of a Userform by the Name

I want to change the text of a form.

What do you mean by the "text of a form"? I will assume you mean the
Caption that appears on the title bar of the form.

Try some code like the following:

Sub ChangeCaption()
Dim FormName As String
Dim NewCaption As String
Dim UF As UserForm
Dim N As Long
Dim B As Boolean
FormName = "UserForm2"
NewCaption = "This Is New"
Load UserForm1

VBA.UserForms.Add FormName

For N = 0 To VBA.UserForms.Count - 1
If StrComp(VBA.UserForms(N).Name, FormName, _
vbTextCompare) = 0 Then
VBA.UserForms(N).Caption = NewCaption
B = True
Exit For
End If
Next N
If B = True Then
VBA.UserForms(N).Show
End If
End Sub


The form whose caption you want to change must already be loaded into
memory, but not necessarily visible. To load a form into memory
without making it visible, use either of

Load UserForm2

' OR

VBA.UserForms.Add "UserForm2"


Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Fri, 21 May 2010 04:28:06 -0700 (PDT), Joe
wrote:

I want to change the text of a form.
I know the name of the form and the name of the control in it.

How to get the control of a form if I know the Name?

Below post refers to adding a form. But I already have a form, just
need the control of that!
http://groups.google.co.in/group/mic... 993ded867dd4

Thanks a lot in advance

Regards'
Joe

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting control on userform with part of control name (set question) Keith Excel Programming 4 January 10th 07 02:24 PM
Dim Userform Control donbowyer Excel Programming 5 October 28th 05 12:09 AM
Control Sequence from Userform Control Nigel Excel Programming 3 December 29th 04 01:25 PM
Userform control Phillips Excel Programming 1 November 20th 03 07:33 PM
UserForm Control John Wilson Excel Programming 0 July 16th 03 06:53 PM


All times are GMT +1. The time now is 06:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"