+ Reply to Thread
Results 1 to 6 of 6

Setting Command Button caption

Hybrid View

  1. #1
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Smile Setting Command Button caption

    Well Im going mad....

    I have a button on a sheet (Active X Command button) called CommandButton1

    I want to set its caption via VBA however every method I can think of results in a "Run time error 438" object doesnt support this property or method.

    Now Im fairly 99% sure Ive done this a dozen times in the past using
    CommandButton1.caption = "My caption"
    nope....

    ActiveSheet.CommandButton1.caption = "My caption"
    nah....

    ActiveSheet.OLEObjects("CommandButton1").Caption = "My caption"
    ActiveSheet.Shapes.CommandButton1.Caption = "My caption"
    all giving the same error, come on folks, what daft thing am I doing wrong?

  2. #2
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Setting Command Button caption

    Hi,

    is this a form control or an activeX control ?
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Setting Command Button caption

    Active X control

  4. #4
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Setting Command Button caption

    Hi,

    try this attached workbook and see if it works.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Setting Command Button caption

    yes that worked fine and when I went into your code, copied and pasted the line into my button event it worked. Yet that is exactly the same command as I was using (first code in my post). All very weird.

    Many thanks

  6. #6
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Setting Command Button caption

    very strange.

    All the best.

+ 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. Command Button Caption
    By tapsmiled in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-23-2014, 09:57 PM
  2. Changing the caption of a Command Button
    By Colin M in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2007, 12:24 PM
  3. using vba to change command button caption
    By PaulaO in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2006, 02:40 PM
  4. [SOLVED] changing the caption of a command button
    By JWCrosby in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2005, 04:15 PM
  5. Command Button Caption
    By Qaspec in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-27-2005, 12:06 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