0

Hi I'am a Newbee in the world of PowerPoint VBA and hope my english is not too bad: I have to solve the following problem in PowerPoint 2010: First I change into the 16:9 widescreen format, then I go through to every picture which are now too big and change with size-dialog box from the picture only by clicking the up and down arrow for scaling height. The picture will be in the right form which I used before in the 4:3 presentation. That is easy but not if you have to change more then 100 of pictures. I tried so many times but nothing works. Here is my code:

Sub ChangePictures()
Dim sld As Slide
Dim sh As Shape
Dim meinShHeight As Double

ActivePresentation.PageSetup.SlideSize = 15

For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
'If sh = msoLinkedOLEObject Or msoTextBox Then
        If sh.Type = msoPicture Then
'meinShHeight = sh.ScaleHeight.Value
'sh.ScaleHeight meinShHeight, msoScaleFromTopLeft
             sh.LockAspectRatio = msoTrue
              With tSlide.Shapes.Select
                  .Height = ActiveWindow.Presentation.PageSetup.SlideHeight
                  .Width = ActiveWindow.Presentation.PageSetup.SlideWidth
             End With
'sh.ScaleHeight  1.75, msoTrue
'sh.ScaleHeight -1.75, msoTrue
        End If
'End If
  Next
Next

End Sub

Perhaps it is impossible to use this up and down arrow trick in VBA? Unfortunately I cannot use PowerPoint 2013 then I didn't have any problem with my presentation.

Is there anybody who can help me. I hope to express my problem in the right way ;-)

Thanks in advance.

Regards Kiki

kiki
  • 1
  • 2

1 Answers1

0

This works for me

Sub ChangePictures()
    Dim sld As Slide
    Dim sh As Shape

    ActivePresentation.PageSetup.SlideSize = 15

    For Each sld In ActivePresentation.Slides
        For Each sh In sld.Shapes
            If sh.Type = msoPicture Then
                With sh
                    .LockAspectRatio = msoTrue
                    .ScaleHeight ActiveWindow.Presentation.PageSetup.SlideHeight, msoTrue
                    .ScaleWidth ActiveWindow.Presentation.PageSetup.SlideWidth, msoTrue
                End With
            End If
        Next
    Next
End Sub
Siddharth Rout
  • 147,039
  • 17
  • 206
  • 250
  • Hello Siddharth, thank you very much for this quick response. Unfortunately, it doesn't work for me. The presentation was changed correctly, but the picture disappeared and I got a big green slide. Do you know what has happend? Thank you in advanced Kiki – kiki Feb 06 '14 at 19:34
  • `and I got a big green slide` Green is usually associated with paranormal activity? Did you show your presentation to a paranormal expert :D Ok jokes apart. Would it be possible for me to see your presentation. Let me check it for you? If yes then upload it in www.wikisend.com and share the link here. – Siddharth Rout Feb 06 '14 at 19:46
  • so today I have to work but tomorrow I will send my presentation to you. It is only one slide with a great picture of mine in order to look what has happend with one picture before I do this with 100 of pictures. Thanks for your help. – kiki Feb 07 '14 at 09:24
  • `with a great picture of mine` Then I am sure it is really haunted :P Anyways, will wait for your link. – Siddharth Rout Feb 07 '14 at 09:27
  • Hello Siddharth, I don't know the plattform wikisend but I upload my PowerPoint presentation. I got this URL http://www.wikisend.com/download/397990/ but if I try to look at I've got a blanc site. So, do you know if I have to wait a little bit longer? Use this link and then tell me if you got the file. kiki – kiki Feb 08 '14 at 15:09
  • I've got it :-) I have to wait. The URL come by mail. I hope soon. – kiki Feb 08 '14 at 15:19
  • Sorry, but I didn't receive any URL until now, so I use the Dropbox. This is the new URL: https://www.dropbox.com/s/hhsmnvvxz9i51c1/Trainerin.pptm. Please have a look at my presentation and use your code then we will see if you find the right solution. Thanks in advance. Kiki – kiki Feb 09 '14 at 17:35