opening a Word document for mail merge
Posted on 2001-07-23
This is my code for opening a document in Word. The problems are as follows: the documents open as microsoft Word form letter 1. When I want to close them I get the question if I want to save microsoft word form letter1, when I reply to this question, I get the question a second time but then with the name of the document I opened.The document opens also minimized. The user has to click the Word logo and then, click maximize with the right mouse button.
Private Sub CombineDoc(NameDoc As String)
Dim objWord As Word.Application
Set objWord = New Word.Application
objWord.Documents.Open App.path & "\" & Namedoc, ReadOnly:=True
objWord.Visible = True
If .State = wdMainAndDataSource Then
MsgBox "the document" & NameDoc & " isn't prepared for mail merge", vbInformation
How can I change this code in order to prevent this from happening?