Results 1 to 26 of 26

AutoCreate Command Buttons-Coloring

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,062

    AutoCreate Command Buttons-Coloring

    I have a macro that creates command buttons on my sheet, and assigns the pertinent Macros to those command buttons. I can adjust the text to the color/style I want, but I can't figure out how to change the background colors. Can someone help? My code is shown below (BTW, after either selection I'll want to remove the buttons ("KillButts")-if someone can clue me on how to do that I'd appreciate that as well).:
    Sub AddButtons()
        Dim strBname As String
        ActiveSheet.Buttons.Add(199.5, 10, 81, 65).Select
        strBname = Selection.Name
        Selection.OnAction = "ResumeAuto" 'Macro to run
        Selection.Characters.Text = "Click here to Resume the Automation" 'Text of button
        With Selection.Characters.Font 
            .Name = "Verdana"
            .FontStyle = "Regular"
            .Size = 9
            .Color = vbBlue
        End With
        
        ActiveSheet.Buttons.Add(299.5, 10, 81, 65).Select
        strBname = Selection.Name
        Selection.OnAction = "KillButts" 'Macro to run
        Selection.Characters.Text = "Click here to Cancel the Automation" 'Text of button
        With Selection.Characters.Font 
            .Name = "Verdana"
            .FontStyle = "Regular"
            .Size = 9
            .Color = vbRed
        End With
        Range("A1").Select
    End Sub
    Sub ResumeAuto()
    MsgBox "Now we're resuming our process"
    End Sub
    Sub Killbutts()
    MsgBox "Now we're killing the buttons"
    End Sub
    Last edited by jomili; 07-25-2011 at 12:16 PM.

Thread Information

Users Browsing this Thread

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

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