Jay
Here's the code
Sub FieldPropertiesBookmark()
'
'This will put the Open and Close requirements round the 6 element field
definitions
Application.ScreenUpdating = False
Call TDWordAddin.mdlRequirments.OpenRequirement 'Inserts a bookmark
Selection.MoveDown Unit:=wdLine, Count:=1
For Field = 1 To 6
Call TDWordAddin.mdlRequirments.OpenRequirement 'Inserts a bookmark
Selection.InsertParagraphAfter
Selection.MoveDown Unit:=wdLine, Count:=1
Call TDWordAddin.mdlRequirments.CloseRequirement 'Inserts a
bookmark
Selection.MoveDown Unit:=wdLine, Count:=1
Next
Call TDWordAddin.mdlRequirments.CloseRequirement 'Inserts a bookmark
Selection.MoveDown Unit:=wdLine, Count:=1
Application.ScreenUpdating = True
End Sub
There are a large number of bookmarks in the document which are used as
placeholders for importing text into Mercury's Quality Center.
> >Running a 13 line Word 2003 macro containing 1 for...next loop with 6 lines
> >in it, even with application.screenupdating=false, takes 44 seconds to run.
[quoted text clipped - 16 lines]
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
Jay Freedman - 12 Jul 2005 16:36 GMT
Hi Martyn,
I don't know what the addin is doing -- in addition to the simple comment
"Inserts a bookmark", it must be finding the locations and keeping track of
the bookmark names, and possibly doing other work -- but I suspect that at
least part of the slowness comes from the overhead of calling the addin
repeatedly.
Another typical cause of slowness is using the Selection object instead of a
Range object, which incurs the cost of recomputing and possibly repaginating
the document, even when ScreenUpdating is turned off.
If this is a serious enough problem, I'd suggest reviewing what the addin is
doing, and rewriting the macro (and possibly the addin, if that's within
your control) to do all the work with Range objects.

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
> Jay
>
[quoted text clipped - 43 lines]
>> Jay Freedman
>> Microsoft Word MVP FAQ: http://word.mvps.org
Howard Kaikow - 12 Jul 2005 20:03 GMT
Try something like:
with Application
.ScreenUpdating = False
with TDWordAddin.mdlRequirments
Call .OpenRequirement 'Inserts a bookmark
Selection.MoveDown Unit:=wdLine, Count:=1
For Field = 1 To 6
Call .OpenRequirement 'Inserts a bookmark
Selection.InsertParagraphAfter
Selection.MoveDown Unit:=wdLine, Count:=1
Call .CloseRequirement 'Inserts a bookmark
Selection.MoveDown Unit:=wdLine, Count:=1
Next
Call .CloseRequirement 'Inserts a bookmark
end with
Selection.MoveDown Unit:=wdLine, Count:=1
.ScreenUpdating = True
end with
And change OpenRequirement, CloseRequirement and the above code to use the
Range, instead of the Selection, object.

Signature
http://www.standards.com/; See Howard Kaikow's web site.