+ Reply to Thread
Results 1 to 3 of 3

change button properties without looping through shapes

  1. #1
    Registered User
    Join Date
    04-30-2009
    Location
    tokyo
    MS-Off Ver
    Excel 2016
    Posts
    42

    change button properties without looping through shapes

    Hello,

    I would like to change the fontstyle of a button. not sure why this works

    ActiveSheet.Shapes.Range(Array("Button 6")).Select

    With Selection.Font
    .FontStyle = "bold"
    End With

    and this doesn't

    ActiveSheet.Shapes.Range(Array("Button 6")).Font.FontStyle = "bold"

    Thank you

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: change button properties without looping through shapes

    I think the difference is that when you're not selecting the shape the syntax has to be different.

    i.e.
    ActiveSheet.Shapes("Button 6").TextFrame.Characters.Font.Bold = True
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: change button properties without looping through shapes

    FWIW, for a Form button, you can simplify to

    Please Login or Register  to view this content.
    Rory

+ 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] Can't Change Visibility of Shapes Border Lines with Toggle Button
    By LokoJoko in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2016, 07:47 AM
  2. [SOLVED] Looping Sheets to change Color of Shapes
    By Hood in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-16-2015, 02:47 PM
  3. Assigning Properties to SHAPES
    By plans in forum Excel General
    Replies: 2
    Last Post: 03-22-2015, 04:00 PM
  4. Looping through Shapes to change transparency
    By JoeSkittles in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-24-2013, 11:09 AM
  5. Have checkbox change properties of spin button (form control)
    By spookymyo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-19-2013, 04:19 AM
  6. Properties for auto shapes
    By zplugger in forum Excel General
    Replies: 3
    Last Post: 12-17-2011, 11:50 AM
  7. Can you change form button properties with a macro?
    By randyvann in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2008, 11:06 AM

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