Page 1 of 1

Auslesen von Bookmarks aus einem Wordfile

Posted: Sat May 23, 2015 2:45 pm
by Hoschik
Hallo,
möchte die Bookmarks (Textmaken) eines Word Dokumentes ermitteln und finde den entsprechenden Aufruf nicht, z.B. durch:

For j := 1 to oWord:ActiveDocument:Bookmarks:Count()
AADD(aTextmarke, oWord:ActiveDocument:Bookmarks(j):Name)
Next j

Das funktioniert nicht! Zwar liefert oWord:ActiveDocument:Bookmarks:Count() die richtige Anzahl, aber oWord:ActiveDocument:Bookmarks(j):Name ist offensichtlich falsch.
Weiß jemand, wie es heißt?
Gruß Hoschik

Re: Auslesen von Bookmarks aus einem Wordfile

Posted: Sun May 24, 2015 7:33 am
by Antonio Linares
Have you tried this ?

For j := 1 to oWord:ActiveDocument:Bookmarks:Count()
AADD(aTextmarke, oWord:ActiveDocument:Bookmarks( j - 1 ):Name)
Next j

Re: Auslesen von Bookmarks aus einem Wordfile

Posted: Sun May 24, 2015 7:35 am
by Antonio Linares
Also try this

AADD(aTextmarke, oWord:ActiveDocument:Bookmarks( j + 1 ):Name)

What error do you get ? Please copy it here, thanks

Re: Auslesen von Bookmarks aus einem Wordfile

Posted: Sun May 24, 2015 9:01 am
by Hoschik
Hallo,
the error I'm getting is:
[3232] -> Error Word.Application:ACTIVEDOCUMENT/0 S_OK: BOOKMARKS Arguments: ( [ 1] = Type: N Val: 2) >NIL<
[3232] -> Error at ...: TOLEAUTO:BOOKMARKS(0) in Module: >../../win32ole.prg<
when i wrote
AADD(aTextmarke, oWord:ActiveDocument:Bookmarks(j+1):Name)
or
AADD(aTextmarke, oWord:ActiveDocument:Bookmarks(j-1):Name)
Gruß Hoschik

Re: Auslesen von Bookmarks aus einem Wordfile

Posted: Sun May 24, 2015 9:13 am
by Antonio Linares
Then it means that your code is right:

Code: Select all

For j := 1 to oWord:ActiveDocument:Bookmarks:Count()
AADD(aTextmarke, oWord:ActiveDocument:Bookmarks(j):Name)
Next j
What error do you get with it ?

Re: Auslesen von Bookmarks aus einem Wordfile

Posted: Sun May 24, 2015 9:43 am
by Hoschik
Hallo,
the compiler can't work with:
CODE: SELECT ALL EXPAND VIEW
syntax error at 'ALL'

Re: Auslesen von Bookmarks aus einem Wordfile

Posted: Sun May 24, 2015 10:22 am
by Hoschik
in addition:
I'm using xHarbour 1.2.1
Hoschik

Re: Auslesen von Bookmarks aus einem Wordfile

Posted: Sun May 24, 2015 9:47 pm
by Hoschik
Hallo,
the following lines work well:

For j := 1 to oWord:ActiveDocument:Bookmarks:Count()
AADD(aBM, oWord:ActiveDocument:Bookmarks:Item(j):Name)
Next j

Thank you four your help
Kind regards, Hoschik

Re: Auslesen von Bookmarks aus einem Wordfile

Posted: Sun May 24, 2015 10:09 pm
by Antonio Linares
very good :-)