Hey,
How can I get the content of a word document into a string variable?
Thanks,
Printable View
Hey,
How can I get the content of a word document into a string variable?
Thanks,
VB Code:
Dim oWord As Word.Application, oDoc As Word.Document, sText As String Set oWord = New Word.Application Set oDoc = oWord.Documents.Open("D:\Test.doc") sText = oDoc.Range(oDoc.Range.Start, oDoc.Range.End).Text Debug.Print sText oDoc.Close oWord.Quit Set oDoc = Nothing Set oWord = Nothing
probably a better way but
ActiveDocument.Select
AllText = Selection.Text