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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 4605 2

Status
Not open for further replies.

KenWK

Programmer
May 25, 2001
76
US
I have a Word macro that uses a custom dialog to navigate and select multiple files for processing. The dialog is then unloaded and file names are kept in and processed from an array. That portion of the macro works properly and will display the names of all the files selected looping through the array with a msgbox command.

The macro works on RTF files which are inserted into a new document, then another very extensive macro is called where many search and replaces and modification of styles among other things happens.

Everything works perfectly EXCEPT that I get the following message after some files have been processed:

4605: The AutoFormatReplaceQuotes method or property is not available because there is a memory or disk problem.

Commenting out that line errors on the very next lines.

I then have to restart Word and run it again. The files I'm testing are small and only 14 will process at a time. I just started a project that has over 1000 files so I'd like to be able to do more than 14 at a time!

This problem also occurred in Word 2000 (the macro has been around a while and updated here and there).

I've tried using ActiveDocument.UndoClear throughout to free up some memory but to no avail.

Any ideas would be most welcome.

Ken
 
Ken: "and the normal.dot that gets attached."

THAT is your basic problem. And it is a basic non-understanding of Word.

I just did a check across our system. There are over 30,000 Word documents - I have worked here for 30+ years - that have I have been responsible for.

Not a single one - not ONE - has Normal.dot attached to it.

Not a single one.

BTW: that 30,000 file check was done by a searching code across multiple servers thousands of miles apart and it took under 4 minutes to process.

I am 1,000% for consistency in documents. Heck, it is what I do for a living. But using manual formatting of any kind - which is what you essentially are doing - is not the way to get consistency. Or rather, more correctly, it is a poor, prone-to-error, way of hoping to get consistency.

Gerry
 
Agreed. Though without distributing a template with the files I don't know of any other way to achieve semi-consistency in Word on an entirely unknown Word installation. Unfortunately, we'd be lucky if most of the people that use the resulting files even knew what a template WAS.

I played around with the range object a bit more in the portion of this macro that goes paragraph for paragraph checking specific things and boy, it sure does run "cleaner." If nothing else the operation I was doing with the selection object was moving the scroll bar, using the range object just blasted through and nothing even flinched on the screen.

Very cool.

Thanks again,
Ken
 
using the range object just blasted through and nothing even flinched on the screen."

Why would it? Range does not affect (until the very end) anything on-screen. It is not using the screen (and its resources) like Selection does.

This is a HUGELY important concept to grasp if you use Word VBA.

99% of the time using Range is much much better than Selection. There a few (VERY few) instances where that is not the case.

The main reason Selection gets used so much is that a lot people learn VBA (appropriately enough) from recording macros. Recorded macros ALWAYS use Selection. Always.

"we'd be lucky if most of the people that use the resulting files even knew what a template WAS."

I hear you.

However...I would like to add that IF a template is well designed and well coded (where code is required), then to a great extent, users do not need to know. IF access to create a new document from that template is well designed, and well coded, then users need to know even less.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top