MS's Macros9.dot file format

A

and

Dear list,

I am using the AutoCorrect utility from the Microsoft macros9.dot
template to back up and restore AutoCorrect entries. I have backed up my
entries, but I can't restore them with this utility.

Trying this, I get the following error message:

"There was an error. The document may be in the incorrect formay.
-2147467259 Method 'AddRichText' of object 'AutoCorrectEntries' failed (c)"


Do I have to export the AC entries into a RTF file? Or maybe a text
file? Does any of you have the same experience with this utility?


Kind regards,
And
 
A

and

Sorry, I should add the function with the AddRichText method that
probably causes the problem.

=============from macros9.dot=========
---------------------------------------------
Function RestoreACEntries()
Dim I, NumRows As Integer
Dim oDoc, oACorrect, oTable As Object

Dim szName As String
Dim szValue As String
Dim szRTF As String

Err.Clear
On Error GoTo RestoreACEntriesErrors:

' check for correct format
If ActiveDocument.Words(1) = "AutoCorrect " Then
Application.ScreenUpdating = False

Set oDoc = ActiveDocument
Set oTable = oDoc.Tables(1)
Set oACorrect = Application.Autocorrect.Entries

NumRows = ActiveDocument.Tables(1).Rows.Count
Selection.GoTo What:=wdGoToTable, Which:=wdGoToFirst
Selection.MoveRight Unit:=wdCell, Count:=3

For I = 2 To NumRows
szName = Selection.Text

Selection.MoveRight Unit:=wdCell
szValue = Selection.Text

Selection.MoveRight Unit:=wdCell
szRTF = Selection.Text

If szRTF = "False" Then
Application.StatusBar = StatMsg1 & szName
oACorrect.Add Name:=szName, Value:=szValue
Else
Application.StatusBar = StatMsg1 & szName

Selection.MoveLeft Unit:=wdCell
oACorrect.AddRichText szName, Selection.Range '<<<!!!
Selection.MoveRight Unit:=wdCell
End If
Selection.MoveRight Unit:=wdCell
Next I
Application.ScreenUpdating = True
MsgBox szRestoreCompletemsg
Else
MsgBox szFormatIncorrect
End If


RestoreACEntriesErrors:
Select Case Err.Number
Case 0:
' no error
Case Else
MsgBox (szACEntriesErrorMsg & vbCr & Err.Number & " " &
Err.Description & " " & szName)
End Select


End Function
------------------------------------------
 
A

and

Hi Jay,

Thanks for your reply. I have tried Dave's template, and it works perfectly.

Is it allowed to use the work of an MVP in my template by copying and
pasting without his or her explicit permission?
 
J

Jonathan West

and said:
Hi Jay,

Thanks for your reply. I have tried Dave's template, and it works perfectly.

Is it allowed to use the work of an MVP in my template by copying and
pasting without his or her explicit permission?

You can freely use the code in your own projects. After all, that is what
the code samples are there for! If you want to republish the source code or
text of articles, then we expect you to ask permission first.

Every article on the Word MVP website includes a link to the terms of use,
which can be found here

http://word.mvps.org/TermsofUse.htm
 

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