Re: delete all bookmarks in file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
****************************************


"Jonas" <Jonas@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C76AA79C-5BAD-4496-B57C-B2E6753E7C9D@xxxxxxxxxxxxxxxx
> 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.
>
> "Vince" wrote:
>
> > Ha ha! Typo!
> >
> > Dim n as Long
> > For n = 1 to ActiveDocument.Bookmarks.Count
> > ActiveDocument.Bookmarks(n).Delete
> > Next n
> >
> > "Jonathan West" <jwest@xxxxxxxx> wrote in message
> > news:uAS%23aIRGFHA.3120@xxxxxxxxxxxxxxxxxxxxxxx
> > >
> > > "Tony Logan" <TonyLogan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > news:B317600F-95B3-4E9D-8047-5A828E3CBBA0@xxxxxxxxxxxxxxxx
> > > > Can a macro delete all bookmarks in a file? I want to be able to
delete
> > > > all
> > > > of them without knowing in advance how many there are, since the
number
> > > > will
> > > > vary from file to file.
> > > >
> > > > I'm using Word XP.
> > > >
> > >
> > > This will do the needful
> > >
> > > Dim n as Long
> > > For n = 1 to ActiveDocument.Bookmarks.Count
> > > ActiveDocument.Bookmarks(1).Delete
> > > Next n
> > >
> > >
> > > --
> > > Regards
> > > Jonathan West - Word MVP
> > > www.intelligentdocuments.co.uk
> > > Please reply to the newsgroup
> > >
> >
> >
> >


.



Relevant Pages

  • Re: Need to chg queried table
    ... > Hi Gunny, ... > Fixed my typo and just get the same error but with a space in it. ... I may have contract number ... >>> Dim dbsCurrent As Database ...
    (microsoft.public.access.formscoding)
  • Re: Activate Multiple Ranges
    ... Andi, ... them all) and when you did declare variables, specifically Dim Const_Range ... you never used it - due to a typo. ... >> End Sub ...
    (microsoft.public.excel.programming)
  • Re: Has anyone posted code to convert longer HEX numbers to DEC strings?
    ... dim x0,x1 ... Paul ... Prev by Date: ...
    (comp.databases.ms-access)
  • Re: query for duplicates
    ... Sorry I missed the typo ... I had heard of the option explicit, ... >> Dim rs As New ADODB.Recordset ... >> Dim strQry As String ...
    (microsoft.public.access.formscoding)
  • Re: Sorted listing
    ... It is a typo in my message but it is correct in my VBA ... >> I am trying to write a VBA program in Word that lists ... >> Dim objOutlook As Outlook.Application ...
    (microsoft.public.word.vba.general)