Home > Back-end >  Ask to read the word bookmarks
Ask to read the word bookmarks

Time:10-06

DELPHI5, want to traverse the bookmarks in word2000:
I: integer;
T, mybookmark: OleVariant;
For I:=1 to WordDocument1. Bookmarks. Count the do the begin

T:=I;
Mybookmark:=WordDocument1. Bookmarks. Item (T). The Name;//where there is an error
.
end;

A DOT in the template file word2000 has five bookmarks, in the first four normal reading,
But when I loop to 5 program prompts error: "collection members requested does not exist,."
Don't know what the reason, give advice or comments please master, thank you!

CodePudding user response:

Uh... Bookmarks from 0 begin counting or starting from 1 count?

CodePudding user response:

Are generally for I:=1 to count - 1 do?

CodePudding user response:

reference 1st floor LastAvengers response:
uh... Bookmarks from 0 begin counting or starting from 1 count?


The problem I am also very strange, word bookmarks started with 1...

CodePudding user response:

refer to the second floor LastAvengers response:
are generally for I:=1 to count - 1 do?


Yes, usually are for I:=0 to count - 1...

CodePudding user response:

All the things:
For I:=WordDocument1. Bookmarks. Count downto 1 do...
Shouldn't be an error...

CodePudding user response:

. Can't... Change operation count? Learning step see,,,,,,
  • Related