Hello,

There must be a simple answer to this. Have looked here and the web, haven't seen the same problem and searching the error message was fruitless as well. My program creates a Word doc, where I'm trying to put the table, that gets filled with info from a userform. The error message is the following:


[-2147417851
Automation Error
The serve threw an exception]


The line of code causing it is:

objDoc.Tables.Add Range:=Selection.Range, NumRows:=3, NumColumns:=4, DefaultTableBehavior:=wdWord9TableBehavior

The following are declared in General Declarations

Public objWord
Public objDoc
Public objSelection

The document is created in a subroutine with the following code:

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add("C:\Users\Username\Desktop\Template 1.dotx")
Set objSelection = objWord.Selection

I can use objSelection with no issues, but it's the objDoc that's causing the problems. If I substitute, "ActiveDocument" for, "objDoc" a table will get created on the doc that I'm using to write the program. I've tried using a subroutine to create the table but I get the same error message. Any help will be appreciated.