2014-02-06 12 views
0

嗨,我是PowerPoint VBA世界中的Newbee,並希望我的英語不是太糟糕:我必須在PowerPoint 2010中解決以下問題:首先我換成16: 9寬屏幕格式,然後通過單擊向上和向下箭頭來縮放高度,然後查看現在太大的所有圖片,並從圖片中隨尺寸對話框更改。這張照片將採用我以前在4:3演示中使用的正確形式。這很容易,但如果你不得不改變100張以上的照片,那麼這種做法就不容易我嘗試了很多次,但沒有任何效果。這裏是我的代碼:如何更改寬屏格式的powerpoint圖片

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 

也許這是不可能在VBA中使用這個向上和向下的箭頭技巧? 不幸的是我不能使用PowerPoint 2013,那麼我的演示沒有任何問題。

有沒有人可以幫助我。我希望以正確的方式表達我的問題;-)

在此先感謝。

問候 奇奇

+0

沒有'sh.ScaleHeight ActiveWindow.Presentation.PageSetup.SlideHeight,msoTrue'幫助? –

回答

0

這對我的作品

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 
+0

你好Siddharth,非常感謝你的快速回復。不幸的是,它不適合我。演示文稿被正確地更改了,但照片消失了,我得到了一張綠色的幻燈片。你知道發生了什麼嗎?謝謝你在先進的奇奇 – kiki

+0

',我得到了一個綠色的大幻燈片綠色通常與超自然的活動相關聯?你把你的演示文稿展示給一個超自然的專家:D好吧開玩笑。我能否看到你的演示文稿?讓我檢查一下嗎?如果是,請在www.wikisend.com上傳並在此分享鏈接。 –

+0

所以今天我必須工作,但明天我會把我的介紹給你。只有一張幻燈片帶有我的精彩照片,以便在用100張照片進行此操作之前查看一張照片發生的情況。謝謝你的幫助。 – kiki