Hello all, I want vb.net code to get selected text from Ms word. Could you kindly help me?
For example,
Imports Microsoft.Offic e.Core
Imports Microsoft.Offic e.Interop
Dim wapp As Word.Applicatio n
Dim wdoc As Word.Document
wapp = GetObject(, "Word.Applicati on")
wapp = Nothing
wdoc = wapp.ActiveDocu ment
wapp.Visible = True
wapp.activedocu ment.range.text 'if i write like this i will get all text from MS word, but i want to get only selected word in MS word, for example, In Ms word it contains "The computer Science" so i want to get only word that i selected. if i select the word "computer" in MS word then i want vb.net code to returns computer " word that i selected". In textbox we just write textbox.selecte d, but i don't know code to get from ms word. please help me.
Thank very much.
For example,
Imports Microsoft.Offic e.Core
Imports Microsoft.Offic e.Interop
Dim wapp As Word.Applicatio n
Dim wdoc As Word.Document
wapp = GetObject(, "Word.Applicati on")
wapp = Nothing
wdoc = wapp.ActiveDocu ment
wapp.Visible = True
wapp.activedocu ment.range.text 'if i write like this i will get all text from MS word, but i want to get only selected word in MS word, for example, In Ms word it contains "The computer Science" so i want to get only word that i selected. if i select the word "computer" in MS word then i want vb.net code to returns computer " word that i selected". In textbox we just write textbox.selecte d, but i don't know code to get from ms word. please help me.
Thank very much.