O
omar.norton
Dear all,
I am currently developing a database with customer details, and there
is a seperate word document that has address labels for each customer.
It is linked to the database by a standard mail merge so you can
choose which customer's address labels to display.
On the main menu form of my database, I have added a button to open
the address labels file using the following code:
Private Sub AddressLabels_Click()
Dim LWordDoc As String
Dim oApp As Object
'Path to the word document
LWordDoc = "G:\Shared\Templates & Forms\Labels\Address Labels.doc"
If Dir(LWordDoc) = "" Then
MsgBox "Document not found."
Else
'Create an instance of MS Word
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True
'Open the Document
oApp.Documents.Open FileName:=LWordDoc
End If
End Sub
This opens the document fine, but you can only view one mail merge
entry and all the mail merge controls on the word toolbar are greyed
out so you can't scroll through entries.
If you go into windows explorer and open the word file it works
absolutely fine, even if the database is running.
Does anybody know how to fix this problem? Thanks
(P.S My VBA knowledge is not huge!)
I am currently developing a database with customer details, and there
is a seperate word document that has address labels for each customer.
It is linked to the database by a standard mail merge so you can
choose which customer's address labels to display.
On the main menu form of my database, I have added a button to open
the address labels file using the following code:
Private Sub AddressLabels_Click()
Dim LWordDoc As String
Dim oApp As Object
'Path to the word document
LWordDoc = "G:\Shared\Templates & Forms\Labels\Address Labels.doc"
If Dir(LWordDoc) = "" Then
MsgBox "Document not found."
Else
'Create an instance of MS Word
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True
'Open the Document
oApp.Documents.Open FileName:=LWordDoc
End If
End Sub
This opens the document fine, but you can only view one mail merge
entry and all the mail merge controls on the word toolbar are greyed
out so you can't scroll through entries.
If you go into windows explorer and open the word file it works
absolutely fine, even if the database is running.
Does anybody know how to fix this problem? Thanks
(P.S My VBA knowledge is not huge!)