none
Adding a text in MS Word using Visual Basic 6.0 RRS feed

  • Question

  • How can I add a text in an existing MS Word Document without replacing the current text using VB 6.0?cing the current text using VB 6.0?
    Tuesday, July 16, 2013 9:57 AM

Answers

  • Basically the same way as in VBA. You first need to "collapse" to the end-point before inserting the additional text so that it doesn't overwrite existing content. Something like:

    Dim rng as Word.Range
    Set rng = wdApp.ActiveDocument.Content
    rng.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
    rng.Text = "The new text"
    


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, July 16, 2013 2:24 PM
    Moderator