Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Word is calculating the word count" message for Properties

Status
Not open for further replies.

RandyJ

Technical User
Jun 14, 2001
7
US
Good Day,

I've experienced this problem in the past but it's not been critical since my documents were small. But now that I'm working on larger documents, it's become a problem.

I've written a script to set several BuiltInDocumentProperity fields. When I run the script it recalculates the word count after setting each property.

For example, the code below will invoke the process, "Word is calculating the word count", after each command. For a set of large documents, it adds a considerable amount of time to the process.

.BuiltInDocumentProperties(wdPropertyAuthor) = pstrAuthor
.BuiltInDocumentProperties(wdPropertyCompany) = pstrCoName
.BuiltInDocumentProperties(wdPropertyHyperlinkBase) = pstrHLBase

I've set both Application.Options.Pagination and Application.Options.AllowFastSaves to False, but to no avail.

Is there a flag I'm missing or am I stuck with this problem.

Thanks for any help you can provide.

Randy Johnston
Best Software, Inc.

 
Randy,

The following tip from Jonathan West may help:
Define an object variable for the CustomDocumentProperties collection, make your changes to that, and then assign the variable back to the CustomDocumentProperties collection. This will reduce the number of times the word count runs to just twice. You can do similar things with the BuiltInDocumentProperties collection.

Not tested for the properties you list, but you could also try to see what happens if you make your changes through the dialog box, along the lines of:
With Dialogs(wdDialogFileSummaryInfo)
.Comments = "New Comments go here"
.Execute
End With

ilses
 
Ilses,

Thanks for your suggestion. I created an object for the BuiltInDocumentProperties as shown below.

Dim propAuthor as DocumentProperty
Dim propCompany as DocumentProperty
Dim propHBase as DocumentProperty

Set propAuthor = objDoc.BuiltInDocumentProperties(wdPropertyAuthor)
Set propCompany = objDoc.BuiltInDocumentProperties(wdPropertyCompany)
Set propHBase = objDoc.BuiltInDocumentProperties(wdPropertyHyperlinkBase)

I got the word recalc after each Set statement.

And funny as it may seem, the Dialogs(wdFileSummaryInfo) does not have a Company property.

Thanks again for your suggestions.

Randy Johnston
 
Randy,

Still haven't found a flag or something like that.

But a search in the microsoft.pubic.word ng turned up with this one by Elizabeth Sullivan:

Sub TestWordCount()
'
'Demonstrates method to cause/avoid Word side effect of updating
'BuiltInDocumentProperties, which is to recalculate the word count in
'the document, which can take quite some time (enough to be
'annoying), depending on the size of the document and the speed of
'the machine.
'
'using the Dialogs method will avoid the recalulation, though you
'are limited to updating the properties referenced in the dialog
'
'using ActiveDocument.BuiltInDocumentProperties(i) will cause it
'
'before running this test, have a document with some text in it
'
Dim Response As Boolean
Dim i As Integer
Dim j As Integer
Dim dlgSumInfo As Dialog
'loop makes it easier to see calculation message when using small
'word file and/or fast machine
Response = MsgBox("Using Dialogs - no word count recalculation",
vbOKOnly)
For j = 1 To 100
For i = 1 To 5
'next 5 lines avoid recalc
Set dlgSumInfo = Dialogs(wdDialogFileSummaryInfo)
With dlgSumInfo
.Title = "a title"
.Author = "an author"
.Execute
End With
Next i
Next j
Response = MsgBox("Using built in's - word count recalculation",
vbOKOnly)
For j = 1 To 100
For i = 1 To 5
ActiveDocument.BuiltInDocumentProperties(i) = "something"
Next i
Next j
End Sub

HTH

ilses

 
ilses,

Thanks again, not only for the post, but for reminding me that there are other sources of information which I should have used prior to taking up your time. :)

I'm going to give this code a run through to see if I can come up with something.

Take care,
Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top