在excel中使用VBA在microsoft word中移动图像

时间:2021-02-08 22:05:43

标签: excel vba ms-word

我正在尝试制作一个自动发票制作器,但我目前无法使用 Excel VBA 在 Word 文档中定位图像

图像可以很好地加载到 Word 文档中,但正是位置导致了我的问题。

编辑: 导致的具体问题是图像原本应位于页面顶部,但显示在插入的文本下方。

在此先感谢您的帮助

Set wordObject = CreateObject("Word.Application")

'create the document object and add documents to it
Set documentObject = wordObject.documents.Add

'setting logo
Set logoObject = documentObject.inlineshapes



'make it visible
wordObject.Visible = True

'create selection object
Set selectionObjectHeader = wordObject.Selection

'place the logo
logoObject.AddPicture ("C:\Users\conno\Documents\logo.png")

With logoObject
    .ConvertToShape
End With

With caniprelogoObject.Shapes(1)
    .Top = 100
    .Left = 100
End With

0 个答案:

没有答案
相关问题