我正在尝试在word文档上选择一个占位符来粘贴剪贴板(我已将excel表复制到其中),但是在粘贴之前很难选择该单词。在Run-time error '450': Wrong number of arguments or invalid property assignment
上获取With Selection.Find
:
ActiveDocument.Content.Select
With Selection.Find '<- Error
.ClearFormatting
.Text = "TablePlaceHolder1"
End With
If Selection.Find.Found = True Then
Selection.Select
End If
ActiveDocument.Range.Paste
我对Word VBA有很多经验,但是从Excel到Word(或PowerPoint)工作我遇到了一连串的错误。
答案 0 :(得分:1)
继续发布我的解决方案(在@ HarassedDad建议使用书签之后):
With WordApp
.Selection.Goto What:=wdGoToBookmark, Name:="TablePlaceHolder3"
.Selection.Paste
End With
比我之前尝试的要简单得多。