Automation error with Clearformatting method????????

H

Howard Kaikow

I suddenly have encountered a problem using the Clearformatting method via
a Word object in a VB 6 DLL.

So, I tried to reproduce the behavior within Word itself, and was able to do
so.

The first sub below results in an error, the second does not.

Can anybody reproduce this problem?
In which version of Word?

Option Explicit

Private Sub TestClearFormattingAutomation()
Dim x As Word.Application
Set x = New Word.Application
With x
.Documents.Add
With .ActiveDocument.Content.Find
On Error Resume Next
.ClearFormatting
Debug.Print Err.Number, Err.Description
Err.Clear
End With
.ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End With
x.quit
set x = nothing
End Sub

Private Sub TestClearFormattingNoAutomation()
With Application
.Documents.Add
With .ActiveDocument.Content.Find
On Error Resume Next
.ClearFormatting
Debug.Print Err.Number, Err.Description
Err.Clear
End With
.ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End With
End Sub
 
H

Howard Kaikow

It's a Retrospect problem.

I lost a hard drive two weeks ago.

Used Retrospect DR to restore drive.

Apparently, either Retrospect does not properly back up Office or Retrospect
does not properly restore files in a disaster recovery!

I ran a Detect and Repair on Office 2003 and rebooted, problem went away!
 

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