how to get the slide background color using VBA?

R

roytang

Hi,

I tried using slide.Background.Fill.BackColor.RGB (or the
corresponding value from the master slide) and it gives me the wrong
color. (I get #993333 where it should be white) Same thing if I use
SchemeColor and map to the correct value in the color scheme instead.

Is this the correct way to do this? Note that my test consists of a
slide where I just type some random text, I'm not actually changing
any color settings. I'm using ppt 2003, if that matters.

Thanks,

Roy
 
G

Guest

Hi Roy

I'm using Hex here but I get FFFFFF both in the edit mode code and in show
mode

Sub editmode()
Dim osld As slide
Set osld = ActivePresentation.Slides(1)
MsgBox Hex(osld.Background.Fill.BackColor.RGB)
End Sub

Sub showmode()
Dim i As Integer
i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
Dim osld As slide
Set osld = ActivePresentation.Slides(i)
MsgBox Hex(osld.Background.Fill.BackColor.RGB)
End Sub
--
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
 
R

roytang

Using your code I still get 993333 :(

I'm not sure what to check anymore. It's correct in ppt2007 though...
 
S

Steve Rindsberg

Hi,

I tried using slide.Background.Fill.BackColor.RGB

You want ForeColor.

BackColor is only used if you're using a patterned fill, gradients or the like.
Otherwise, the value you get from it is pretty much meaningless.

(or the
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top