Word Hang Bookmarks

M

MickOM35

I have a problem with the followed macro under Word. I have a document with
35 pages and I bookmarked each lines of this document which means that I have
nearly 600 bookmarks named started by SIMILIS_ and then a number beetween 1
and 600. The aim of this macro is to highlight each bookmarks. The problem
which appears is that after a while I have a message from MsWord which tells
me thar I do not have enough memory space and asks me if I want to continue.
If I clicked Yes Word crashes !!! I don't understand the problem at all.

Thanks in advance for your help. If you need to test this Macrowith my
document, don't hesitate to write me and I will send it to you.

Reagrds,

Mickaël


Sub HighLight_Actif()

Dim bkMks As Bookmarks

Set bkMks = ActiveDocument.Bookmarks

MsgBox "Test"

Dim Words
For Words = 1 To 5000 Step 1
Dim name
Dim Range As Range

name = "SIMILIS_" & Words
If bkMks.Exists(name) = True Then
Set Range = bkMks.Item(name).Range
Range.HighlightColorIndex = wdYellow
End If


Next Words

MsgBox "End " & Words


End Sub
 
J

Jean-Guy Marcil

MickOM35 was telling us:
MickOM35 nous racontait que :
I have a problem with the followed macro under Word. I have a
document with 35 pages and I bookmarked each lines of this document
which means that I have nearly 600 bookmarks named started by
SIMILIS_ and then a number beetween 1 and 600. The aim of this macro
is to highlight each bookmarks. The problem which appears is that
after a while I have a message from MsWord which tells me thar I do
not have enough memory space and asks me if I want to continue. If I
clicked Yes Word crashes !!! I don't understand the problem at all.

Thanks in advance for your help. If you need to test this Macrowith
my document, don't hesitate to write me and I will send it to you.

Maybe the undo list becomes too unwieldly for Word... Throw in a
ActiveDocument.UndoClear
at the end of the loop.
That might help.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
M

mickOM35

Thanks a lot ! You solve my problem.
En français : merci beaucoup ! C'était effectivement cela le problème ! Un
dépassement de la mémoire à cause du Undo !!! Encore merci et meilleurs voeux
à tous pour cette année 2005
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top