Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
dwalthrs
 
Posts: n/a
Default How do I find word #547 from the beg of a word doc?

I want to be able to select words at random based on their depth from the
beginning of the document.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Cindy M -WordMVP-
 
Posts: n/a
Default How do I find word #547 from the beg of a word doc?

Hi ?B?ZHdhbHRocnM=?=,

I want to be able to select words at random based on their depth from the
beginning of the document.

Well, keeping in mind that Word may interpert what a "Word" is differently
than you, a macro like this could help:

Sub GoToWordN()
Dim doc As Word.Document
Dim lNumWords As Long
Dim lTarget As Long
Dim sTarget As String

Set doc = ActiveDocument
lNumWords = doc.Words.Count
sTarget = InputBox( _
"Enter the word-index to which you want to go:")
If IsNumeric(sTarget) Then
lTarget = CLng(sTarget)
If lTarget 0 And lTarget = lNumWords Then
doc.Words(lTarget).Select
Else
MsgBox "Invalid word-index. The document contains " _
& lNumWords & " words.", vbOKOnly + vbInformation
End If
End If
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 97 in Windows XP to maintain formatting Charlie''s Word VBA questions Microsoft Word Help 22 May 20th 23 08:51 PM
Converting WordPerfect 12 files to Word 2003 Curious New Users 4 May 19th 23 02:48 PM
Compare Word to Wordperfect? Joe Santora Microsoft Word Help 1 April 13th 06 05:16 PM
Word should allow to 'divide' page by 3 or 4, not just 2 CandasK Page Layout 2 February 28th 06 10:16 PM
In Word, how can I see all files (*.*) in "save as"? citizen53 New Users 8 April 4th 05 04:56 PM


All times are GMT +1. The time now is 08:49 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"