+ Reply to Thread
Results 1 to 7 of 7

Change font size on command buttons with VBA

  1. #1
    Registered User
    Join Date
    07-27-2012
    Location
    Sydney Aust
    MS-Off Ver
    Excel 2010
    Posts
    92

    Change font size on command buttons with VBA

    I have an issue with my command buttons automatically changing size when using multiple screens with different resolutions.

    The solution I have found with the buttons is to include this code to the end of the botton click routine, but the font sometimes changes. So now I need the code to reset the font size

    Please Login or Register  to view this content.
    The code hangs up on the last row and returns the error

    Run-time error '438'
    Object doesnt support this property or method.

    any hints?

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Change font size on command buttons with VBA

    Hi,

    There is nothing wrong with your code, and it works fine on my computer (also running Excel 2010). Could you please upload your workbook with the error so that I can attempt to replicate your issue in your workbook before trying to solve it.

    Thanks

  3. #3
    Registered User
    Join Date
    07-27-2012
    Location
    Sydney Aust
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Change font size on command buttons with VBA

    botton sizes.xlsm

    Sorry for the delay file attached

  4. #4
    Registered User
    Join Date
    07-27-2012
    Location
    Sydney Aust
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Change font size on command buttons with VBA

    Quote Originally Posted by ajryan88 View Post
    Hi,

    There is nothing wrong with your code, and it works fine on my computer (also running Excel 2010). Could you please upload your workbook with the error so that I can attempt to replicate your issue in your workbook before trying to solve it.

    Thanks
    file posted above thanks in advance

  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Change font size on command buttons with VBA

    try so
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-27-2012
    Location
    Sydney Aust
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Change font size on command buttons with VBA

    Quote Originally Posted by nilem View Post
    try so
    Please Login or Register  to view this content.
    Thanks
    that works great.

    Now comes the next question which is related to OLEObject
    If I had 20 buttons on a sheet how can i determine the number of each of them without running this code and seeing which button changes

  7. #7
    Forum Contributor
    Join Date
    01-20-2012
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Change font size on command buttons with VBA

    You can do so by looping through all objects and e.g. change it if objectname matches:

    Please Login or Register  to view this content.

+ 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. How to using comma style without change font & font size
    By rameshtupe in forum Excel General
    Replies: 1
    Last Post: 07-11-2013, 01:19 PM
  2. [SOLVED] Change default font and font size on COMMENTS in cells
    By Thistledown in forum Excel General
    Replies: 4
    Last Post: 11-23-2012, 09:26 AM
  3. Command Buttons on Excel Worksheet - font size decreases on click
    By John.Greenan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-07-2006, 10:45 AM
  4. Controlling size of command buttons
    By pagelocator in forum Excel General
    Replies: 1
    Last Post: 10-13-2005, 09:05 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