在Excel中复制范围,在MSWord文档中查找特定文本,替换为剪贴板图像

时间:2014-02-17 15:56:56

标签: excel vba ms-word copy-paste

我正在将Excel中的范围复制为图像,我想将其插入到word文档中作为虚拟文本“Qwerty01”的替换。现在它打开word文档并将图像粘贴到顶部 - 如何在粘贴之前将光标移动到虚拟文本?

Sub automateword()

Dim sheet1 As Object
Dim wdFind As Object

Set wordapp = CreateObject("word.Application")
wordapp.documents.Open ThisWorkbook.Path & "\Word.docx"


wordapp.Visible = True
Set sheet1 = Sheets("Prog General (1)")
Set wdFind = wordapp.Selection.Find

sheet1.Range("D14:N46").CopyPicture Appearance:=xlScreen, Format:=xlPicture
wdFind.Text = "Qwerty01"
wordapp.Selection.Paste
End Sub

0 个答案:

没有答案