Create Word Application
Dim WApp As Word.Application
Set WApp = New Word.Application
Create Word Document
Dim WDoc As Word.Document
Set WDoc = WApp.Documents.Open(Filepath)
To Create\Add new Word Document
Dim NewWDoc As Word.Document
Set NewWDoc = WApp.Documents.Add
WDoc.Range.Copy
NewWDoc.Range.PasteAndFormat wdFormatOriginalFormatting
Define a Paragraph as Range
Set Rng = WDoc.Range(WDoc.Paragraphs(1).Range.Start, WDoc.Paragraphs(1).Range.End - 1)
Copy The data from Excel to end of word document
ActiveSheet.Range("A1").Copy
WDoc.Paragraphs(WDoc.Paragraphs.Count).Range.Paste
Loop All the words In a Paragraph
For Wrd = 1 To WDoc.Paragraphs(2).Range.Words.Count
MsgBox WDoc.Paragraphs(2).Range.Words(Wrd)
Next
Define the Range in a paragraph based on words
If WDoc.Paragraphs(2).Range.Words(Wrd) = "Begin Here" Then
StartRng = WDoc.Paragraphs(2).Range.Words(Wrd).Start
End If
If WDoc.Paragraphs(2).Range.Words(Wrd) = "End Here" Then
EndRng = WDoc.Paragraphs(2).Range.Words(Wrd).End
End If
Set Rng = WDoc.Range(StartRng, EndRng)
Define the Paragraph and Range
Dim Pgraph As Paragraph
Set Pgraph = WDoc.Paragraphs(3)
Pgraph.Alignment = WdParagraphAlignment.wdAlignParagraphLeft
With Pgraph.Range
.Font.Name = "Calibri"
.Font.Size = 12
.Font.ColorIndex = wdBlue
.Font.UnderlineColor = wdColorBrightGreen
End With