Macro locks Word XP - any ideas why?

T

Thane Walkup

This macro originally was in the Document_Open function, and the document
would never open on Word XP, which would stop responding pretty much forever
(let it run for 1/2 hour on P4 2.8ghz w/512mb RAM).

Any ideas?
Thanks,
Thane

---Start code---
Sub test()
ActiveDocument.Tables(1).Borders.Enable = True ' Enabled for testing
purposes
If ActiveDocument.Tables.Count >= 1 Then
If ActiveDocument.Tables(1).Borders.Enable = True Then
For i = 1 To ActiveDocument.Tables.Count
With ActiveDocument
.Tables(i).Borders.Enable = False
.Tables(i).Range.InsertBreak Type:=wdColumnBreak
.Tables(i).Range.InsertBreak Type:=wdColumnBreak
.Tables(i).Range.InsertBreak Type:=wdColumnBreak
.Tables(i).Range.InsertBreak Type:=wdColumnBreak
.Tables(i).Range.InsertBreak Type:=wdColumnBreak
.Tables(i).Range.InsertBreak Type:=wdColumnBreak
.Tables(i).AutoFitBehavior wdAutoFitWindow
End With
Next i
End If
End If
End Sub
---end code---
 
T

Thane Walkup

On further testing, if there is one line of ".Tables(i).Range.InsertBreak
Type:=wdColumnBreak", the macro runs fine. As soon as I uncomment the
second line, the performance becomes iffy.

I'm honestly not sure what this script is supposed to do, since I've
inherited the script at this worksite, and nobody else seems to know what it
does either.
 

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