Re: MS Word 2004 basic questions
Re: MS Word 2004 basic questions
- Subject: Re: MS Word 2004 basic questions
- From: kai <email@hidden>
- Date: Wed, 7 Feb 2007 15:49:47 +0000
On 7 Feb 2007, at 14:01, some blabbermouth wrote:
On 2 Feb 2007, at 22:49, email@hidden wrote:
Is there a way I could get the whole word that the selection is
part of?
Something like this should do it:
That was a bit more convoluted than it needed to be. Take 2:
---------------
set search_text to text returned of (display dialog "Enter the text
to find:" default answer "")
tell application "Microsoft Word"
set selection's selection end to 0
set selFind to find object of selection
set selFind's content to search_text
set text_found to execute find selFind
if not text_found then return beep (* signal failure *)
tell (create range active document start 0 end selection's selection
end)
set word_count to count words
set word_start to end of content of words 1 thru (word_count - 1)
set word_end to end of content of words 1 thru word_count
set found_word to set range it start word_start end word_end
end tell
content of found_word
end tell
---------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden