Define a Range : Word Text « Word « VBA / Excel / Access / Word






Define a Range

 
Sub RangeText()
    Dim wdApp As Word.Application
    Dim wdDoc As Document
    Dim wdRng As Word.Range
    
    Set wdApp = GetObject(, "Word.Application")
    Set wdDoc = wdApp.ActiveDocument
    
    Set wdRng = wdDoc.Range(0, 22)
    wdRng.Select
    
    Set wdApp = Nothing
    Set wdDoc = Nothing
    Set wdRng = Nothing
End Sub

 








Related examples in the same category

1.TypeText method inserts text into a Word document
2.The Range object selects paragraphs.