Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / April 2007

Tip: Looking for answers? Try searching our database.

4:3 -> Widescreen PPPresentation: VBA transfer help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arcy - 08 Apr 2007 10:16 GMT
I have a powerpoint presentation that is ~1k slides (each slide containing
one image), which comes out to around 175mb. This is not much of a problem,
it loads a little slow, but it fits on our thumbdrive, and it showcases the
work we want.

The problem is that 'It Has Been Decided' that we need a widescreen version
of this presentation. I, being the lowly student hire, have been tasked with
this.

I found one way of transfering the slides' contents from one 4:3
presentation to another widescreen formatted presentation thanks to a really
old post on these boards, which linked to here:
http://www.rdpslides.com/pptfaq/FAQ00566.htm . The VBA macro at the bottom of
that page worked like a charm...

...except that the new file size exploded to ~750 mbs. Doesn't like to load,
save, close, or do anything else really.

I did come across the PPTools optimizer, which shrunk it to ~500mb, but
that's still too large and runs slow. Looking at the VBA from that page, I
noticed that it's essentially taking a screencap of the old slides and
pasting that as an enhanced metafile (whatever that is). This means that the
new images have large bars the colour of our slide background (black)
wherever the image didn't take up the entire slide, making each image that
much bigger.

Is there a way to edit that VBA code to make it copy only the existing
images and transfer them over to the new file? (A solution I'm hoping will
shrink the file-size further - I tried doing this myself, but came up eith
some exciting errors.)

If not, is there anything else I can do to shrink the filesize?

Thanks!
Steve Rindsberg - 08 Apr 2007 15:31 GMT
> I have a powerpoint presentation that is ~1k slides (each slide containing
> one image), which comes out to around 175mb. This is not much of a problem,
[quoted text clipped - 26 lines]
> shrink the file-size further - I tried doing this myself, but came up eith
> some exciting errors.)

Assuming you're using 2003, locate this bit of code:

For Each oSourceSlide In oSourcePres.Slides
  [snip snip snip]
       oSourceSlide.Copy
       Set oSh = oTargetSlide.Shapes.PasteSpecial(ppPasteEnhancedMetafile)(1)

Change ppPasteEnhancedMetafile to ppPastePNG or ppPasteJPG

Make no other changes, then run the code on your original presentation, not one
that's already been "processed".

The original code uses metafiles so that you can still ungroup and edit the text
and other content if need be, but metafiles don't compress images, which is why
your converted version gets so badly bloated.

Switching to PNG or JPG images will leave the results uneditable but will give
you much better image compression.

Give it a try, c'mon back, report on the results.  Thanks!

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Arcy - 09 Apr 2007 00:06 GMT
I changed that bit of code around, and tried some of the other options as
well. While it works (down to 254 mbs with jpg!), the downside is that there
is a noticable drop in the image's quality.

Is there a way to modify the code to make it - essentially - select all,
copy, and paste into the new PPP in the same way I would do it manually,
which doesn't alter the image quality (or carry-over the black bars on images
that don't extend to the page margins).

> > I have a powerpoint presentation that is ~1k slides (each slide containing
> > one image), which comes out to around 175mb. This is not much of a problem,
[quoted text clipped - 53 lines]
> PPTools:  www.pptools.com
> ================================================
Steve Rindsberg - 09 Apr 2007 13:49 GMT
> I changed that bit of code around, and tried some of the other options as
> well. While it works (down to 254 mbs with jpg!), the downside is that there
> is a noticable drop in the image's quality.

That's the dark side of JPGs.  Might want to see how it works with PNGs instead.

> Is there a way to modify the code to make it - essentially - select all,
> copy, and paste into the new PPP in the same way I would do it manually,
> which doesn't alter the image quality (or carry-over the black bars on images
> that don't extend to the page margins).

Probably so but it'll take a lot more coding to get it right.  What makes it simple
(as is) is that you can treat all the shapes on the slide as a single grouped unit
for scaling purposes.  

If you copy/paste individually or copy/paste the shapes on a slide, you run into
troubles 'cause PPT won't let you group placeholders.  And if you can't scale/move
the shapes as a group, it gets trickier by far.

> > > I have a powerpoint presentation that is ~1k slides (each slide containing
> > > one image), which comes out to around 175mb. This is not much of a problem,
[quoted text clipped - 53 lines]
> > PPTools:  www.pptools.com
> > ================================================

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Arcy - 09 Apr 2007 14:24 GMT
I can definitly see the benifit of that... the metafile would work great for
slides with large amounts of content on them.

I managed to hack together my own solution in VBA to automate much of it,
and I'll include the code below for anyone interested. It will copy a
selected image on one slide, create a new slide on a second presentation,
paste the image, and then resize/center it on the new slide.

The Setup: Ensure both presentations are open and onscreen
(Window->Cascade). Select the image you want to copy from the old
presentation, and run the macro. To copy the next image, reselect the
original presentation, move to the next slide, select the next image, and
wash, rince, repeat.

The Code:

Sub copyImageAndResizeForHeight()

‘yay variables
Dim oView As View
Dim oTargetPres As Presentation
Dim dSafeMargin As Double

‘copy the currently selected image in the original presentation window,
‘and then select the new, widescreen formatted presentation
ActiveWindow.Selection.Copy
Windows.Item(Index:=2).Activate

‘in the wide presentation, create a new blank slide
With ActivePresentation.Slides
    Set oView = ActiveWindow.View
    oView.GotoSlide .Add(oView.Slide.SlideIndex + 1, _
                                      ppLayoutBlank).SlideIndex
    Set oView = Nothing
End With

‘paste the image into the new slide in the widescreen presentation
ActiveWindow.View.Paste

‘The rest of this code resizes the image to make it the full height of the
slide
   Set oSh = ActiveWindow.Selection.ShapeRange
   Set oTargetPres = ActivePresentation
   dSafeMargin = 0 ‘alter this number if you want a margin above&below your
image
   
   With oTargetPres.PageSetup
          ‘resize
           oSh.Height = .SlideHeight - (dSafeMargin * 2)

           ' center
           oSh.Left = (.SlideWidth - oSh.Width) / 2
           oSh.Top = (.SlideHeight - oSh.Height) / 2

       End With
       
End Sub

I created a second version of this macro for instances where the image was
significantly wider then it was tall. In this case, it would resize the image
to fit the width of the screen. It's all the same except for one line,
changing:
oSh.Height = .SlideHeight - (dSafeMargin * 2)
to:
osh.Width = .SlideWidth - (dSafeMargin * 2)

Took me ~30 minutes to go through each slide all told, but it allowed me to
ensure each image was sized correctly, and kept the file size exactly the
same. If someone can find a way to automate the rest of it, all the more
power to them.

Thanks for the help/info Steve!

> Probably so but it'll take a lot more coding to get it right.  What makes it simple
> (as is) is that you can treat all the shapes on the slide as a single grouped unit
[quoted text clipped - 3 lines]
> troubles 'cause PPT won't let you group placeholders.  And if you can't scale/move
> the shapes as a group, it gets trickier by far.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.