Word Interaction

Add-in Express™ Support Service
That's what is more important than anything else

Word Interaction
Reading text from word 
ashish sharma


Guest


Hi,

I m able to get the text from word document when the text is selected using object of word.selection,
Is there any way where i can extract the text of a document without selecting it and that to if i can extract line by line text of by paragraph by paragraph.

Regards
(Ashish Sharma)
Posted 17 Dec, 2007 07:44:02 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Ashish.

Please draw your attention on the following properties of Word document:
Word._Document.Paragraphs
Word._Document.Words
Word._Document.Sentences
Posted 17 Dec, 2007 11:01:48 Top
ashish sharma


Guest


Hi Sergey

Private Sub AdxScan_Click1(ByVal sender As Object) Handles AdxScanNow.Click
Dim objFrmRun As New frmRunWwNow
Dim ActiveWindow As Object = Me.HostApplication.ActiveWindow

WordSelection(ActiveWindow, objFrmRun) ' calling function here
objFrmRun.ShowDialog()
End Sub

Private Sub WordSelection(ByVal Window As System.Object, ByVal obj As frmRunWwNow)
Select Case Me.HostName
Case "Word"
Dim Selection As Word.Selection = CType(Window, Word.Window).Selection
MsgBox(Selection.Text) ' msgbox displaying the selected text

Dim ashpara As Word.Paragraphs = CType(Window, Word.Window).ashpara
' the above declaration is giving me error

Can you please send me the code for
Word._Document.Paragraphs
Word._Document.Words
Word._Document.Sentences
Posted 20 Dec, 2007 06:18:25 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Ashish.

Please read about these properties in Microsoft Visule Basic Help for Word (Alt-F11, F1).
Posted 20 Dec, 2007 08:23:33 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Ashish, I was not able to send you an email.
Please download the project with my changes here:
http://www.add-in-express.com/projects/temp/rnd.zip
Posted 28 Dec, 2007 11:42:58 Top