+ Reply to Thread
Results 1 to 6 of 6

Change Default Label Caption with VBA

  1. #1
    Registered User
    Join Date
    09-22-2011
    Location
    san diego
    MS-Off Ver
    Excel 2013
    Posts
    76

    Change Default Label Caption with VBA

    Hi, I'm having trouble figuring out how to get a label caption change to 'Stick'

    I'd like to make the label change 'permanent' when I execute a particular event.

    If my default label is "Hello" and I execute the below, it will change to "World" until I close the userform. Upon executing, I'd like to change the default caption so the next time the form opens, it will say "World."

    Please Login or Register  to view this content.
    I've dug around a bit and have seen some code like the below, but haven't been able to get it do do anything other than the code above.

    Please Login or Register  to view this content.
    Thanks in advance

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: Change Default Label Caption with VBA

    Personally, I'd just use your code in UserForm_Initialize or Activate event.

    Edit: If you want to change label caption based on some condition...
    You could have a sub/function in standard module that dynamically changes your caption string.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    09-22-2011
    Location
    san diego
    MS-Off Ver
    Excel 2013
    Posts
    76

    Re: Change Default Label Caption with VBA

    Ya, this is simplified to the root of what I'm trying to accomplish....essentially I have a ticketing system. Request -->Approval-->Approval kicks out several files, one of which is a new excel file with the userform with a header label caption locked in with the ticket number.

    I can always put something into a very hidden sheet/etc but I was wondering if I could accomplish a "clean" file generation.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: Change Default Label Caption with VBA

    You could do it like below as well...
    Please Login or Register  to view this content.
    Note this only works when Userform is not loaded.

  5. #5
    Registered User
    Join Date
    09-22-2011
    Location
    san diego
    MS-Off Ver
    Excel 2013
    Posts
    76

    Re: Change Default Label Caption with VBA

    That's IT!! Thanks!

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: Change Default Label Caption with VBA

    You are welcome and thanks for the rep

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Label caption change combobox
    By inteliits in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-24-2015, 03:41 PM
  2. Properties for Label Caption when using VB Script to change.
    By Marie A. in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2014, 08:23 AM
  3. [SOLVED] Change the caption of OLEobjects label
    By SIMBAtheCAT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2014, 10:59 AM
  4. [SOLVED] Macro to change ActiveX Label Caption
    By CherylC in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2014, 04:52 PM
  5. [SOLVED] Change Label Caption VB...
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-02-2013, 09:17 AM
  6. Label caption change... Run Code
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-30-2009, 09:16 AM
  7. [SOLVED] Label in Excel... change caption from VB
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2006, 08:45 PM

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