Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get text from Word (MS Office) window or file
#1
examples

Macro Get text from MS Office Word
Code:
Copy      Help
;/exe 1
typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application a._getactive ;;connect to Word. On Vista/7, macro process must run as User. QM normally runs as Admin. The /exe 1 tells QM to run the macro in separate process, as User.
Word.Range r

;get all text
r=a.ActiveDocument.Range
str sAllText=r.Text
out sAllText

;get selected text
r=a.Selection.Range
str sSelText=r.Text
out sSelText

;BEGIN PROJECT
;main_function  Get text from MS Office Word
;END PROJECT

Macro Get text from a Word document file
Code:
Copy      Help
typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Document d._getfile(_s.expandpath("$documents$\document1.doc"))
Word.Range r

;get all text
r=d.Range
str sAllText=r.Text
out sAllText


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)