OLE Automation Access - Word
Hi - I was wondering if someone could help me? I'll start at the begining: I need a user to open a word document (from Access) which has some static text(mail merge) and I need to append data from a form to it. This isn't a problem I've used the basic code shown in the automation chapter 15 OF ACCESS 2003 VBA with some slight modifications - API call to CMDLG32.dll assigning the file name to a string and passing the string to the getobject function as a parameter. Now the problem starts I get 2 word documents opened, the merge template document and another "Form document" both with the same info? Is it possible only to open the new document with all the staic and dynamically assigned text?
Code snippit below. (Be kind to me I'm new to this game ;o))
Private Sub CmdGetCmnDlg_Click()
On Error GoTo Err_CmdGetCmnDlg_Click
Dim strPath As String
Dim WordDoc As Word.Document
strPath = GetFile // Function call to API common dialog returning selected document path.
If (strPath = "") Then
Set WordDoc = GetObject(strPath)
WordDoc.Application.Visible = True