Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word.basic
Message
From
25/06/1999 02:42:25
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
24/06/1999 12:56:23
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
00232735
Message ID:
00233855
Views:
151
>>>Does anyone knows what will be the methods that I have to use to select all the text, change the font and save a word *.DOC. using Word.Basic intantiated as an object by VFP
>>>
>>>Thanks.
>>
>> Go into Word and record a macro doing what you want - then view the code and copy it to VFP. You will obviuosly have to change it, but the functions will be there.
>>
>>
>>
>
>Wayne
>
>Then what will be the difference of instantiating a 'word.basic' or a 'word.application' object??
Word.basic was used by version 7.0 and earlier. Version 8 (word97) uses word.application. Word.application itself has a wordbasic object and that means you could use word.basic commands in a word.application (not all of them really). Instantiating and using word.basic has the advantage that you wouldn't need to check version most of the time and would work for word95&word97.
oWord = createobject("word.basic")
with oWord
* Word.basic commands compatible to both versions

oWord = createobject("Word.application")
with oWord
*VBA specific commands
   with .wordbasic   && Use its wordbasic object
     * Word.basic commands compatible to both versions
Now for your original question, here is a sample that would find bold and convert to nonbold, red, 20 points, wingdings :
lcInfile = getfile("doc")
IF !empty(lcInfile)

  PUBLIC oWordDocument
  *** set the LOCALEID to English
  nlLocaleId=sys(3004)	&& Save local id
  =sys(3006,1033)	&& We will be sending instructions in English

  oWordDocument=getobject("","word.basic")	&& Create word object
  WITH oWordDocument
    .appshow
    .fileopen(lcInfile)  && Open file
    .StartOfDocument	 && Go to start
    .EditFindClearFormatting	&& Start a find&replace
    .EditFindFont(,,,,,,,,,,,,,,,,1) && Find bold
* Replace with 20 points, underline, red, wingdings, remove bold
    .EditReplaceFont(20,1,6,,,,,,,,,,,,,"Wingdings",0) && Set replacement font
    .EditReplace("","",0,,,,,,0,1,1,0)  && Do replacement
*    .editselectall
  ENDWITH
  Release oWordDocument

  **** Set the LocaleId to the previous value
  =sys(3006,val(nlLocaleId))
ENDIF
This word.basic code is compatible with word95&97.
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