+ Reply to Thread
Results 1 to 8 of 8

Dynamic Userform doesnt update label caption

  1. #1
    Registered User
    Join Date
    08-09-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Dynamic Userform doesnt update label caption

    Hi,
    I have multiple Userforms with labels etc, all controls are similarily named (so I could do this) and I can refer to the Userform dynamically but the Label caption/Controls don't change, any idea's how to get them working.

    I have zero experience with VBA or any programming for that matter.

    this is the Code I use which works but the captions don't change
    Thanks in advance for any help.

    Please Login or Register  to view this content.
    Last edited by Heresy; 08-10-2009 at 12:00 PM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Dynamic Userform doesnt update label caption

    Hi Heresy
    change the code to reference the exact name of the userfrom
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Dynamic Userform doesnt update label caption

    Good morning Heresy

    ...and welcome to the forum!!
    Quote Originally Posted by Heresy View Post
    I have multiple Userforms with labels etc, all controls are similarily named (so I could do this) and I can refer to the Userform dynamically but the Label caption/Controls don't change, any idea's how to get them working.
    Are you perhaps making this more diccicult than it needs to be?
    This works fine for me.
    Please Login or Register  to view this content.
    You don't need to declare it an an object or anthing else - just announce you want to work with it.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Dynamic Userform doesnt update label caption

    I think you need to xplain what you are doing. Are you trying to create a userform within your code?

    Also, you haven't declared Formname as a variable & yo try to use it before giving it value
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Dynamic Userform doesnt update label caption

    You need to switch two lines round in your code as Roy said and then show the form:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  6. #6
    Registered User
    Join Date
    08-09-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Dynamic Userform doesnt update label caption

    Thanks for the replies.

    What I want to do is not use:
    Please Login or Register  to view this content.
    because I have more than 1 Userform, ie Userform1, Userform2 I want to write a single procedure which will end up changing Label1.Caption. The tricky part is the procedure may use Userform1 Or Userform2 or others...the Label on either Userform will have the same name to make it easier if necessary.
    Please Login or Register  to view this content.
    The oUserform part I have works but, the Caption doesn't change. I have watched the code run with no problems it just does it and nothing changes. Label caption remains blank

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Dynamic Userform doesnt update label caption

    The code I posted does work - did you try it?
    If so, is your form set to show modelessly? If it is, you would need to specifically repaint it.

  8. #8
    Registered User
    Join Date
    08-09-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Dynamic Userform doesnt update label caption

    Okay it works, thanks for your help. works perfectly. It's in the right order now.
    Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1