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