This is an update of my previous post.
We are merging data with a Word doc. Depending on certain conditions, we insert a second doc and merge data to the second doc.
The merge for the second doc is done in a Sub and we have been using the following code in the Sub to do this.
Code:
Set objWord = GetObject(, "Word.Application")
Set oDoc = objWord.ActiveDocument
The error occurrs at this point and states that "The command is not available because no document is open".
Code:
Do While TheEnd = False
If rstC!AffNeeded1 = True Then
objWord.ActiveDocument.Bookmarks("BottomBook").Select
objWord.Selection.InsertBreak Type:=wdSectionBreakNextPage
objWord.Selection.InsertFile FileName:= <FileName>
It works fine until the Sub is called.
A little history: This report has been run, almost daily, for about 4 years. The code has not been changed. The failures started happening around the 14th of this month.
Anyone have any thoughts?
Thanks
Ray