Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2006

Tip: Looking for answers? Try searching our database.

trapping run-time error 4198

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ctyrrell@stny.rr.com - 05 Jul 2006 04:04 GMT
I am experiencing a run-time error 4198 when comparing certain Word
documents using vba (from Access 2000 - automating Word 2000). In
general, I think it is caused when trying to compare documents that
have already been compared. My problem is that I cannot trap the error.
I have an On Error goto statement right before the doc.Compare filename
statement, but it does not go to the error handler when the error
occurs, instead presenting the 'Command failed' message to the User and
then showing the yellow highlight on the Compare command when the
'Debug' button is clicked. I have tried setting the DisplayAlerts to
each of the 3 different choices right before the Compare, all to no
avail. Behaviour remains the same. The same code works fine for many
other documents, but I want to gracefully be able to handle this
problem, even if it is only to log the error and move on to the next
file to be processed.

Any ideas on why I can't trap this error? Anything different I can do?
Any way I can detect if the file has already been compared, and thus
avoid comparing when it would cause this error?

Any help much appreciated, Thanks
Christine
Cindy M  -WordMVP- - 05 Jul 2006 10:04 GMT
> I am experiencing a run-time error 4198 when comparing certain Word
> documents using vba (from Access 2000 - automating Word 2000). In
[quoted text clipped - 10 lines]
> problem, even if it is only to log the error and move on to the next
> file to be processed.

Assuming the problem is that a document has already been compared, then
it probably contains changes that haven't yet been accepted/rejected? If
you test doc.Revisions.Count is it greater than 0 in such cases? Could
you use this test to avoid the problem?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
ctyrrell@stny.rr.com - 05 Jul 2006 18:31 GMT
Cindy,
Thanks for taking the time to respond. Your suggestion helped for
certain files. Certainly in the files I have to test with, in every
case where doc.Revisions.Count > 0, I would experience the Command
failure.

I'm still hoping to find some other properties or methods I can use to
find/avoid other causes.
Thanks so much,
Christine
Raj - 17 Aug 2006 08:05 GMT
Hi

I have the same problem but my context is this:

The vba code is in Excel. The aim is to list all word documents that exist
in a folder and check if they are password protected. It is able to open the
document but when asked for the password, if cancel is pressed or the
password is wrong, I get 4198. I have put all types of error trapping.

> Cindy,
> Thanks for taking the time to respond. Your suggestion helped for
[quoted text clipped - 6 lines]
> Thanks so much,
> Christine
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.