Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find and highlight word in a word document
Message
From
08/10/2009 15:02:56
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/10/2009 09:38:38
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01428224
Message ID:
01428325
Views:
35
Hi Peter,
Sorry I didn't understand.

You can avoid the dialog using DisplayAlerts = 0 (or .F.) and Close(0) - or another value (wdSave,wdPrompt,wdDonotsave as I remember).

PS: No wonder, everybody loves Istanbul:)
Cetin

>Thanks Cetin,
>almost perfect. The action is correct but the selected words have a red fontcolor and a horizontal line through it. No background color
>
>also can the dialog 'do you want to save this doc' be avoided and the changes (highlite) just be thrown out? It's just for viewing!
>
>Thanks again
>
>
>Peter
>(btw my daughter now lives n istambul and loves it - except she got caught by the riots and had to hide under a table in a restaurant)
>
>
>>>i have an application which keeps tack of documents among other things.
>>>one of the routine queries the database for documents containing a list of word like 'finance' and 'meltdown' and it will return a handfull of .docs with those words in it in a grid.
>>>the use can select a line in the grid and the program will open the word doc in MSWord.
>>>
>>>now it woud be helpful if alloccasions of the words 'finance' and 'meltdown' would be highlited.
>>>
>>>this code:
>>> .Selection.Find.ClearFormatting
>>> With .Selection.Find
>>> .Text = "of"
>>> .Replacement.Text = ""
>>> .Forward = True
>>> .Wrap = wdFindContinue
>>> .Format = False
>>> .MatchCase = False
>>> .MatchWholeWord = False
>>> .MatchWildcards = False
>>> .MatchSoundsLike = False
>>> .MatchAllWordForms = True
>>> EndWith
>>> .Selection.Find.Execute
>>>
>>>does it one at a time. Is there a way to highlite ALL?
>>>
>>>
>>>Thanks
>>>
>>>
>>>Peter
>>
>>
>>lnOldHLColor = .Options.DefaultHighlightColorIndex
>>.Options.DefaultHighlightColorIndex= 7  && wdYellow
>>
>>.Selection.Find.Execute(,,,,,,,,,,2)
>>
>>.Options.DefaultHighlightColorIndex = m.lnOldHLColor
>>
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform