0

Powerpoint 2007 の [検索] ボタンの動作を再現しようとしています。 vba を記述して検索しているテキストを見つけることはできましたが、テキストを含む図形をメインの中央に配置したいと考えています。窓。私のコードは正しいスライドと形状を選択しますが、表示されません。

ppt.Presentations.open(strFloorPlan)
For each sld in ppt.Activepresentation.Slides
    For each shp in sld.shapes
        if shp.hasTextFrame then
            set txtrng =  shp.textFrame.TextRange
            set foundtext =txtrnd.Find(findwhat:="A string representing my search criteria)
            do while not (foundtext is nothing)
                sld.select      'This works
                shape.select    'This works

             **At this point I have my text selected, but is off screen. I would like                  it to be in the current ppt window, so the users do not net to find it.**

            Loop
         End if
     Next
Next
4

2 に答える 2

1

これで近づきます:

ActiveWindow.ScrollIntoView shp.Left, shp.Top, shp.Width, shp.Height

指定した座標 (つまり、形状の座標) によって囲まれた領域が完全に表示されるようにします。ただし、現在のビューではシェイプが中央に配置されません。

于 2013-08-19T13:49:14.477 に答える
0

以下を追加して、検索で見つかった形状の場所を画面の中央に変更します (形状がプレゼンテーションよりも小さい場合)。

shp.Top = (ActivePresentation.PageSetup.SlideHeight - shp.Height) / 2
shp.Left = (ActivePresentation.PageSetup.SlideWidth - shp.Width) / 2
于 2013-08-19T06:42:23.737 に答える