Setting background transparent in VB and save as GIF (PPT 2007)

V

Vincent Verheul

Hello,

In PowerPoint 2003 I successfully use Visual Basic code to save a Powerpoint
Slide into GIF format with a transparent background. This does not seem to
work anymore in PowerPoint 2007. I have selected the option "Save as
PowerPoint 97-2003".

This is the code:

Sub TestTransparency(PPT As PowerPoint.Application, Pres As
PowerPoint.Presentation)
Const FileName = "TestTransparency.ppt"
' skipped some code to set the PPT and Pres objects
PPT.Visible = True
With Pres.Slides(1)
.FollowMasterBackground = False
.Background.Fill.BackColor.RGB = RGB(255, 255, 255)
.Background.Fill.Transparency = 1
End With
Call Pres.SaveAs(FileName, ppSaveAsGIF)
' PowerPoint saves the GIF in a separate folder with the name of the
selected slide
End Sub

In fact I am running this out of an MsAccess application using the
PowerPoint library, but that should not make a difference.

Also when doing this manually via the PowerPoint user interface the saved
GIF file has no transparent background: In a slide use the right mouse
button and select Format Background ... then select Solid Fill, Hide
Background Graphics, (optionally select a color, I use white: RGB
255,255,255) and set Transparency to 100%. Then Save As... Other Formats...
GIF.
 
D

Douglas J. Steele

While you may be running the code from Access, it sounds as though it's
actually a PowerPoint issue.

I think you'll have a better chance of getting an answer if you repost your
question to a newsgroup related to PowerPoint. It may be worth mentioning in
the repost that you are using Automation, in case that's relevant.
 
V

Vincent Verheul

Hi Steve,

Thanks for your help and the 'Export' tip. Hopefully PowerPoint will get an
update at some point in the future. In the meantime I'm looking into the
TransparentBlt function in library "Msimg32.dll" as a workaround.

I save the PPT as GIF because the application creates HTML pages with them.
Also included are mapped coordinates which create 'hot spots' in HTML.

Thx. Vincent
 
V

Vincent Verheul

Steve,

In the statement Call Pres.SaveAs(FileName, ppSaveAsGIF) the extension in
FileName is ignored. PowerPoint creates a Folder with the name FileName and
the gif image is saved within that folder. The name of the gif file is
Slide1.gif (the name depends on the user interface language). The same
happens when I use the Export statement (in PPT 2003, did not try with PPT
2007). It looks like this is part of the 'save as HTML' process in which a
separate folder is created that holds the images.

In my routine I continue to copy the Slide1.gif file to the correct folder
and rename it to FileName with the extension gif. After that I delete the
Slide1.gif file and folder.

Vincent
 
V

Vincent Verheul

Using the Slide.Export function is indeed much easier, thanks!
I'm afraid that using the TransparentBlt function (out of VBA) is too
complex.
 

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