Hey, How can I get the content of a word document into a string variable? Thanks,
Don't anthropomorphize computers -- they hate it
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
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
Check out my CodeBank submissions: VB6 - UUE Encoder/Decoder, Base64 Encoder/Decoder, yEnc Encoder/Decoder, Memory Mapped Files, String/File Differences, Count TIF Pages
probably a better way but ActiveDocument.Select AllText = Selection.Text
JPnyc rocks!! (Just ask him!) If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Forum Rules