Consulting

Results 1 to 3 of 3

Thread: Change BackGround Color of Label (Active X Control)

  1. #1

    Change BackGround Color of Label (Active X Control)

    Hi All - New user here. I have a Label on on my slide that I wish to change the color. How do I do it?

    Label1 is a simple rectangular control. It fills the Label with "Hello World" text, then errors on the color change. And it's an obvious error that states "object does not support this property or method". My goal is to put the text on the screen and change the background color of it. There's probably a better way to do this and I'd be thankful for any suggestions.???

    ActivePresentation.Slides(1).Shapes("Label1").OLEFormat.Object.Caption = "Hello World"
    ActivePresentation.Slides(1).Shapes("Label1").OLEFormat.Object.Fill.BackCol or.RGB = RGB(255, 183, 2)

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    You need to work in HexaDecimal

    ActivePresentation.Slides(1).Shapes("Label1").OLEFormat.Object.BackColor = &H2B7FF ' = RGB(255,183,2)
    You can also say
    ActivePresentation.Slides(1).Shapes("Label1").OLEFormat.Object.BackColor = RGB(255,183,2)
    In the second example the RGB value will give a long which will be converted to Hex for you. I would use method 1 if you are able, 2 is easier but one day MSFT will change the settings and it will fail!!
    Last edited by John Wilson; 01-05-2018 at 05:28 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    Thanks !!! The .FILL was what was giving me the problem. After leaving it off, as you suggested, it works great!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •