Auslesen von Bookmarks aus einem Wordfile

Post Reply
Hoschik
Posts: 7
Joined: Sat May 23, 2015 7:59 am

Auslesen von Bookmarks aus einem Wordfile

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Auslesen von Bookmarks aus einem Wordfile

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Auslesen von Bookmarks aus einem Wordfile

Post by Antonio Linares »

Also try this

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

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

Antonio Linares
www.fivetechsoft.com
Hoschik
Posts: 7
Joined: Sat May 23, 2015 7:59 am

Re: Auslesen von Bookmarks aus einem Wordfile

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Auslesen von Bookmarks aus einem Wordfile

Post 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 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Hoschik
Posts: 7
Joined: Sat May 23, 2015 7:59 am

Re: Auslesen von Bookmarks aus einem Wordfile

Post by Hoschik »

Hallo,
the compiler can't work with:
CODE: SELECT ALL EXPAND VIEW
syntax error at 'ALL'
Hoschik
Posts: 7
Joined: Sat May 23, 2015 7:59 am

Re: Auslesen von Bookmarks aus einem Wordfile

Post by Hoschik »

in addition:
I'm using xHarbour 1.2.1
Hoschik
Hoschik
Posts: 7
Joined: Sat May 23, 2015 7:59 am

Re: Auslesen von Bookmarks aus einem Wordfile

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Auslesen von Bookmarks aus einem Wordfile

Post by Antonio Linares »

very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply