robert_marquardt
asked on
for each to Word with COM
I have implemented a Word AddIn in Delphi which uses the COM interface of Word 97.
What i miss is the "for each" loop of VBA to access all the elements of a list even when the index is string not integer. Some lists of Word cannot be enumerated with integers.
I suspect the undocumented property _NewEnum (from the imported OLB) to provide the access.
Has anyone explored this property and its usage?
I think this is a "feature" to force the programmers to use VBA even with COM interfaces.
What i miss is the "for each" loop of VBA to access all the elements of a list even when the index is string not integer. Some lists of Word cannot be enumerated with integers.
I suspect the undocumented property _NewEnum (from the imported OLB) to provide the access.
Has anyone explored this property and its usage?
I think this is a "feature" to force the programmers to use VBA even with COM interfaces.
ASKER
Bookmarks are indexed with their names.
So its BookmarkList.Items('Name of Bookmark')
Some of these lists cannot be indexed by numbers or they have noncontigous indices and throw an exception on nonexistant elements. Even with a message box on Word side.
So its BookmarkList.Items('Name of Bookmark')
Some of these lists cannot be indexed by numbers or they have noncontigous indices and throw an exception on nonexistant elements. Even with a message box on Word side.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
use
for lp := 0 to Dem.count-1
begin
Myvariable := Dem(lp);
end;
that generally works,
can you give me a specific example you are thinking of
Rob;-)