编写代码以在ms字中更改Visual Basic中图像的位置

时间:2013-08-28 15:36:05

标签: vba ms-word word-vba

由于ms字不允许录制宏来改变已插入的&的位置。我需要在visual basic中编写一个宏。

需要执行以下操作:  1.为选定的图片添加边框  2.将其位置更改为页面的下端。

1 个答案:

答案 0 :(得分:0)

如果文档(InlineShape)中只有一个ActiveDocument,则以下代码可以解决您的两种需求:

Sub qSolved()

    With ActiveDocument.InlineShapes(1)
        'border
        .Line.Weight = xlThin
        'conversion to Shape
        .ConvertToShape
    End With

    'bonus :) -if you need to set position of newly created Shape
    With ActiveDocument.Shapes(1)
        .Top = 100
        .Left = 100
    End With
End Sub