Results 1 to 2 of 2

Thread: [2005] Re: [2005] How to get number of selcted text in MS word

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    20

    Unhappy [2005] Re: [2005] How to get number of selcted text in MS word

    Thank so much for your helping.

    your coding is not match that i want. i want code in vb.net to get number of selected text in MS word.

    For example,

    Imports Microsoft.Office.Core
    Imports Microsoft.Office.Interop

    Dim wapp As Word.Application
    Dim wdoc As Word.Document
    wapp = GetObject(, "Word.Application")
    wapp = Nothing
    wdoc = wapp.ActiveDocument
    wapp.Visible = True
    wapp.activedocument.range.text 'if i write like this i will get all text from MS word.
    but i want to get number of selected word in MS word, for example, if i select the word "boy" in MS word then i want vb.net code to returns 3 "Number of word selected". In textbox we just write textbox.selected. please help me.

    Thank very much.

  2. #2
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Re: [2005] Re: [2005] How to get number of selcted text in MS word

    If you want the no. of words then
    vb Code:
    1. Selection.Words.Count

    If you want the no. of characters then
    vb Code:
    1. Selection.Characters.Count
    Microsoft Techie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width