2014-10-27 60 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