Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Having trouble with Automating Goto in MS Word
Message
 
 
To
29/03/2001 16:11:29
Bill Drew
Independent Consultant
Chicago, Illinois, United States
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00490068
Message ID:
00490071
Views:
11
Here is the code I use to locate a bookmark:
lparameter tcBookMark
if vartype(tcBookMark) <> "C" or empty(tcBookMark)
   return NO_BOOKMARK_PASSED
endif
if NOT oWord.ActiveDocument.Bookmarks.Exists(tcBookMark)
   return BOOKMARK_MISSING
endif
oWord.Selection.GoTo(wdGoToBookMark, , , tcBookMark)
return ACTION_SUCCESSFUL
>I have created a Word Object in Fox Pro, can open a document, can search and replace, print, save, etc. But I'm having trouble with goto using bookmarks.
>
>I recorded a macro of the operation. The VBA code is Selection.GoTo What:=wdGoToBookMark, Name:="RegisName". I include a type library so that the constant wdGoToBookMark gets tranlated to the value -1.
>
>I Translate the named parameters to ordered parameters in the Fox code: oWord.Selection.Goto(wdGoToBookMark,"RegisName"). But the insertion point doesn't go the the bookmark named RegisName.
>
>When I used the object browser, there are four arguments to Selection.Goto. They are expressed as ([What],[Which],[Count],[Name]). Tamar Granor and Della Martin warn that the order of the parameters can sometimes be hard to figure out from reading the recorded macro.
>
>Does anyone know what these 4 parameters are, what their order are, and if they are all necessary. I assume that What is 'wdGoToBookmark', and Name is "RegisName". But I worry that Which and Count may also be necessary.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform