Results 1 to 4 of 4

I can use VBA to create a text box, how do I set the background colour?

Threaded View

irf90 I can use VBA to create a... 09-29-2014, 05:26 PM
Leith Ross Re: I can use VBA to create a... 09-29-2014, 06:30 PM
irf90 Re: I can use VBA to create a... 09-30-2014, 08:53 AM
Leith Ross re: I can use VBA to create a... 09-30-2014, 10:42 AM
  1. #1
    Registered User
    Join Date
    03-02-2007
    Posts
    2

    I can use VBA to create a text box, how do I set the background colour?

    Firstly I'm new to VBA, but trying to learn to make Excel more useful in work.

    My company is using Excel 2003(!) and I'm trying to create custom buttons which add text boxes to selected cells - I want to create a series of buttons to create different coloured text boxes. Through lots of google searching, and some background reading I've managed to come up with the following code to create a text box the size of selected cells

    Sub TextBox()    
         If TypeName(Selection) = "Range" Then
            With Selection
                ActiveSheet.Shapes.AddTextbox _
                  msoTextOrientationHorizontal, .Left, _
                  .Top, .Width, .Height
            End With
        End If
    End Sub
    Despite numerous tries, I can't figure out what code, or where to place it to set parameters such as font size, alignment and fill colour for the text box. Any help greatly appreciated.
    Last edited by irf90; 09-30-2014 at 10:35 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 07-31-2012, 08:41 AM
  2. Replies: 4
    Last Post: 12-21-2011, 11:32 AM
  3. [SOLVED] Change Row Background Colour When Text Is Entered Into A Cell
    By AlexRoberts in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2010, 01:28 PM
  4. formating text and background colour
    By pitway in forum Excel General
    Replies: 1
    Last Post: 09-14-2006, 02:42 PM
  5. [SOLVED] In Excel, colour formatting (text and background) reverts to blk
    By malcolm in forum Excel General
    Replies: 1
    Last Post: 07-12-2006, 03:20 PM

Tags for this Thread

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