> Ha ha! Typo!
>
> Dim n as Long
> For n = 1 to ActiveDocument.Bookmarks.Count
> ActiveDocument.Bookmarks(n).Delete
> Next n
No typo. You try it my way and then your way, and see which works.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Vince - 23 Feb 2005 02:43 GMT
Oops! I take that back. Sorry!
> > Ha ha! Typo!
> >
[quoted text clipped - 4 lines]
>
> No typo. You try it my way and then your way, and see which works.
Vince, you should have tried it first, before proving so gleeefully to the
world that you're an obnoxious fuckwit.
> Ha ha! Typo!
>
[quoted text clipped - 17 lines]
>> ActiveDocument.Bookmarks(1).Delete
>> Next n
when I use this method for deleting all bookmarks, for some reason the var n
only goes up to half of the ActiveDocument.Bookmarks.Count total and then
exits the loop. If I try to force the loop to calculate over half, it shows
the Bookmarks(n) to be invalid. anybody have any clues?
Thanks alot,
J.
> Ha ha! Typo!
>
[quoted text clipped - 17 lines]
> > ActiveDocument.Bookmarks(1).Delete
> > Next n
Greg Maxey - 15 Apr 2005 20:59 GMT
Jonas,
Try this:
Sub DeleteBookmarks()
Dim n As Long
For n = ActiveDocument.Bookmarks.Count To 1 Step -1
ActiveDocument.Bookmarks(n).Delete
Next n
End Sub

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> when I use this method for deleting all bookmarks, for some reason
> the var n only goes up to half of the ActiveDocument.Bookmarks.Count
[quoted text clipped - 32 lines]
>>> www.intelligentdocuments.co.uk
>>> Please reply to the newsgroup
Jonas - 15 Apr 2005 22:02 GMT
Thanks for your reply.
But I dont think this is going to work for me because Im controlling Word
from a non-microsoft language through com-handles.
> Jonas,
>
[quoted text clipped - 44 lines]
> >>> www.intelligentdocuments.co.uk
> >>> Please reply to the newsgroup
Vince - 16 Apr 2005 05:35 GMT
Should be (1).Delete and NOT (n).Delete. I thought it was a typo back then
until Jonathan corrected me.
****************************************
Dim n as Long
For n = 1 to ActiveDocument.Bookmarks.Count
ActiveDocument.Bookmarks(1).Delete
Next n
****************************************
> when I use this method for deleting all bookmarks, for some reason the var n
> only goes up to half of the ActiveDocument.Bookmarks.Count total and then
[quoted text clipped - 25 lines]
> > > ActiveDocument.Bookmarks(1).Delete
> > > Next n