+ Reply to Thread
Results 1 to 4 of 4

Macro to change ActiveX Label Caption

  1. #1
    Registered User
    Join Date
    12-03-2012
    Location
    Indianapolis, IN
    MS-Off Ver
    Excel 2010
    Posts
    8

    Macro to change ActiveX Label Caption

    I needed to put a Checkbox on a Worksheet. The standard Checkbox options in Excel FormControl and ActiveX Control were too small. I found a work-around using the following macro attached to an ActiveX Label that was formatted as Wingdings font. The macro basically changes the character from a empty box Wingdings Chr(168) to a checked box Wingdings Chr(254) when the user clicks on the label. That part is solved. See below for my question/problem.

    Private Sub Label1_Click()

    If Label1.Caption = Chr(254) Then
    Label1.Caption = Chr(168)
    Else
    Label1.Caption = Chr(254)
    End If

    End Sub

    My issue - I have a separate macro that will copy data from a response worksheet (ResponseWst) into my master workbook (SummaryWst). I need to make the checkbox status on the ResponseWst, whether it is Chr(168) or Chr(254), copy into the SummaryWst as well.

    I've tried this:
    If ResponseWst.Shapes("Label1").Caption = Chr(254) Then
    SummaryWst.Shapes(Label1).Caption = Chr(254)
    Else
    SummaryWst.Shapes("Label1").Caption = Chr(168)
    End If

    But I get this error on an ErrorHandler that I have included in the macro.
    "An error has occurred. Error number =438. Error Description=Object doesn't support this property or method."

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Macro to change ActiveX Label Caption

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    12-03-2012
    Location
    Indianapolis, IN
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Macro to change ActiveX Label Caption

    That worked. Thank you so very much!!!

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Macro to change ActiveX Label Caption

    You're welcome.

+ 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] Userform change label caption based on cell
    By thirdbrad in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-02-2014, 11:53 AM
  2. [SOLVED] Change Label Caption VB...
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-02-2013, 09:17 AM
  3. Programatically change the caption of all Worksheet (ActiveX) controls
    By redseujac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-04-2011, 01:11 PM
  4. Label caption change... Run Code
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-30-2009, 09:16 AM
  5. Label in Excel... change caption from VB
    By gonecrazybacksoon@gmail.com 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