2014-10-27 132 views
0

我的ActiveDocument只包含TEXT。VBA删除ActiveDocument Word VBA脚本中的所有文本

我想删除活动文档中的所有文本,并将其设置为存储在字符串中的文本。

E.g.

Dim str as String 
str = "bla bla bla . . ." 
ActiveDocument.Selection. 
    .Find = ?? ' I dont know what to find becuase I just want to delete all the texts. 
    .Replace.Text = str 

回答

1

简单地覆盖全文,我觉得这应该工作:

Dim str As String 
str = "bla bla bla ..." 

ActiveDocument.Range.Text = str