Selection.GoTo What:=wdGoToBookmark, Name:="bmBeginningOfDocument"
Selection.PasteAndFormat (wdPasteDefault)
I used the above code as a better idea on how to get to the location.
Question
I'm moving data from one document to another. I need to move the data and already have it as a string. I just don't know how to put it in the other word document.
The following is getting the text.
'finds a range of text between the words "Purpose" and "Scope" and makes it strThePurpose
Application.ScreenUpdating = False
Selection.HomeKey wdStory
Selection.Find.Text = "Purpose"
blnFound = Selection.Find.Execute
If blnFound Then
Selection.MoveLeft wdWord
Set rng1 = Selection.Range
Selection.Find.Text = "Scope" 'changed here 2014-18-04 from "7.0 Revisions:" to "Revisions:"
blnFound = Selection.Find.Execute
If blnFound Then
Set rng2 = Selection.Range
Set rngFound = ActiveDocument.Range(rng1.Start, rng2.Start)
strThePurposeText = rngFound
'MsgBox (strTheText)
End If
End If
I just don't know how to put it in the word document at a specific line in the template file.
Answer that seems to work:
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst, Count:=7, Name:=""
Selection.TypeText Text:=strTheRefDocsText
A better and more effective approach is to insert a bookmark in word and insert at the bookmark into the word template.
Selection.GoTo What:=wdGoToBookmark, Name:="bmBeginningOfDocument"
Selection.PasteAndFormat (wdPasteDefault)
Solution
Selection.GoTo What:=wdGoToBookmark, Name:="bmBeginningOfDocument"
Selection.PasteAndFormat (wdPasteDefault)
I used the above code as a better idea on how to get to the location.