Kamran
Kamran

Reputation: 4100

VBA Delete all the text in ActiveDocument Word VBA script

My ActiveDocument only contains TEXT.

I want to delete all the text in the active Document and set it to the text stored in a string.

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

Upvotes: 0

Views: 699

Answers (1)

David Zemens
David Zemens

Reputation: 53623

Simply overwrite the full text, I think this should work:

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

ActiveDocument.Range.Text = str

Upvotes: 1

Related Questions