Visual Basic System Error in Word 2007

B

Berlie

I recently upgraded to Windows Vista and Word 2007 from Xp and Word 2003.

I have a VBA project for Microsoft Word that was created in Word 2003. It is
stored in a template file. The template file includes a custom toolbar with
tools that launch macros I have developed. For example one of these macros
asks me to input the name of a chapter, then inserts a section break, adds
the chapter title and applies a specific style to it. Another macros will
paste unformatted text and update the table of contents.

I tested this VBA project in the BETA versions of Vista and Word 2007 on a
different computer and did not have any problems.

When using the toolbar macros in Word 2007 on this computer they will run
perfectly few times times and then I get a "Microsoft Visual Basic" error
message 'System Error &H80004002 (-2147467262) No such interface supported'.

An example of one of the macros is below:


Sub PasteText()
Dim TOC As TableOfContents

Selection.PasteSpecial , Link:=False, DataType:=wdPasteText,
Placement:=wdInLine
For Each TOC In ActiveDocument.TablesOfContents
TOC.Update
Next TOC

End If


Exit Sub

My macro security is set to enable all macros and trust access to the VBA
project model.

Any ideas?
 

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