1

VBAを使用してWord2003のテキストの後ろに写真を折り返すのに問題があります。他のすべてのラッピングオプションは問題なく使用できますが、wdWrapBehindを使用しようとすると、次のエラーが発生します。

「コンパイルエラー:変数が定義されていません」

私は運が悪かったグーグルを通して周りを探し回った。

コード:

      Dim shape1 As shape
      Dim imagePath1 As String

      imagePath1 = "C:\image.jpg"

      Set shape1 = ActiveDocument.Shapes.AddPicture(imagePath1)

      With shape1
        .ScaleHeight 1, msoTrue
        .ScaleWidth 1, msoCTrue
        .LockAspectRatio = msoTrue
        .WrapFormat.Type = wdWrapBehind
        .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
        .RelativeVerticalPosition = wdRelativeVerticalPositionPage
        .Left = InchesToPoints(0.433)
        .Top = InchesToPoints(0.413)
      End With

どんな助けでも感謝します!

乾杯、マイケル

4

1 に答える 1

1

wdWrapBehindの代わりにこれらの4行を追加することで、なんとか機能させることができました。

        .WrapFormat.AllowOverlap = True
        .WrapFormat.Side = wdWrapBoth
        .WrapFormat.Type = 3
        .ZOrder 5

完全なコード:

    Dim shape1 As shape         
    Dim imagePath1 As String            
    imagePath1 = "C:\image.jpg"            
    Set shape1 = ActiveDocument.Shapes.AddPicture(imagePath1)   

    With shape1
        .ScaleHeight 1, msoTrue
        .ScaleWidth 1, msoCTrue
        .WrapFormat.AllowOverlap = True
        .WrapFormat.Side = wdWrapBoth
        .LockAspectRatio = msoTrue
        .WrapFormat.Type = 3
        .ZOrder 5
        .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
        .RelativeVerticalPosition = wdRelativeVerticalPositionPage
        .Left = InchesToPoints(6.889)
        .Top = InchesToPoints(0.374)
    End With
于 2012-10-02T21:41:02.450 に答える