Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Jumping to a Bookmark in Word
Message
From
11/06/2002 09:36:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00666768
Message ID:
00666891
Views:
17
>>>>>Hi, the sintax to jump to a Bookmark is
>>>>>
>>>>>expressão.GoTo(What, Which, Count, Name)
>>>>>
>>>>>How can I use this within VFP?
>>>>>Regards,
>>>>
>>>>Jose,
>>>>oWord.ActiveDocument.Goto(-1,,,"BookMarkName")
>>>>or :
>>>>oWord.WordBasic.EditGoto("BookMarkName")
>>>>
>>>>Use Goto or editgoto if you're using word.basic (pre Word97) and not not word.application (a wordbasic object exists if you need).
>>>>
>>>>oWord.Activedocument.Bookmarks("BookmarkName").Select
>>>>
>>>>Cetin
>>>
>>>Hi Cetin, I sent you a private message (I needed to attach some Screen Shots), but it returned with an error...
>>
>>Hi Jose,
>>If you need you could email using envelope icon :)
>>Cetin
>
>I know that, but the message returned...
>
>Your message has encountered delivery problems
>to the following recipient(s):
>
>cetin@imst.deu.edu.tr
>Delivery failed
>
>Unable to deliver to destination domain
>Can't interpret host name, or non-existant host
>
>Regards,

Jose,
I saw your post to Tamar. Maybe this would help :
*#include wdconst.h
#Define wdWithInTable  12
#Define wdStory  6
#Define wdTable  15
#Define wdCollapseEnd  0
#Define wdSeparateByCommas  2
#Define wdSeparateByParagraphs  0
#Define wdSeparateByTabs  1
#Define wdTableFormatColorful1  8
#Define wdTableFormatColorful2  9
#Define wdTableFormatColorful3  10

#Define CHR_TAB	chr(9)
#Define CHR_CR	chr(13)+chr(10)
Local loWord, lcMyTable

lcMyTable1 = "Parameters" + CHR_TAB + "Limit" + CHR_TAB + "Average" + CHR_CR ;
  + "Chlorine"   + CHR_TAB + "13.5"  + CHR_TAB + "10"      + CHR_CR ;
  + "Boron"      + CHR_TAB + "55.8"  + CHR_TAB + "45"      + CHR_CR

lcTempFile = sys(2015)+'.tmp'
Use employee
Copy fields First_name, last_name, Title ;
  to (lcTempFile) type delimited with TAB
lcMyHeader = chrtran('First Name,Last Name,Job Title',',',CHR_TAB)+CHR_CR
lcMyTable2=lcMyHeader+ChrTran(FileToStr(lcTempFile),'"','')
Erase (lcTempFile)

loWord   = newobject('word.application')
With loWord
  .Documents.Add()
  With .Selection
    .EndKey(wdStory)
    .InsertParagraphAfter()
  Endwith
  .ActiveDocument.Bookmarks.Add('StringTable') && Bookmark table positions
  With .Selection
    .EndKey(wdStory)
    .InsertParagraphAfter()
  Endwith
  .ActiveDocument.Bookmarks.Add('EmployeeTable')

  PutWordTable(loWord,lcMyTable2, 'EmployeeTable') && Add in reverse order - using bookmarks
  PutWordTable(loWord,lcMyTable1, 'StringTable')
  Clear
  .Visible = .t.
Endwith

Function PutWordTable
  Lparameters toWord, tcTable, tcBookmarkName
  With toWord.ActiveDocument
    .Bookmarks(tcBookmarkName).Select
    With .Application.Selection
      .Collapse(wdCollapseEnd)	&& Go to end of bookmark
      If .Information(wdWithInTable) && If we're in a table
        .MoveEnd(wdTable)
        .Collapse(wdCollapseEnd)	&& Get out of table
        .InsertParagraph()			&& Split table
        .Collapse(wdCollapseEnd)	&& Clear selection
      Endif
      .Text = tcTable
      loTable = .ConvertToTable(wdSeparateByTabs,,,,wdTableFormatColorful2,.f.,,,,,,.f.,,.f.)
      .Collapse(wdCollapseEnd)
    Endwith
  Endwith
  Return
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
Reply
Map
View

Click here to load this message in the networking platform