Word object in a control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to add a word document based on a template in a bound object as
embedded documet to be saved in my database field.
 
If you know what you need, you could create it yourself in about an hour,
even with very little Access experience.
 
Ok I admit my question was a bit to short ;-)
What I have is a form with an bound object that should contain a word file.
What I want is that user doblle click on the object and word will be opened
with a certain template. Now the problem I have is that I want that the
company name and costumer name that i saved in another field is inserted in
word. The user can then save the word not as file but embedded in access.
I show you the code I have made.

Private Sub dokument_DblClick(Cancel As Integer)
On Error GoTo Error_dokument_Click
If IsNull(Me.dokument.Value) Then
With Me![dokument]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLEEmbedded
' Class statement for Word document.
.Class = "Word.Document"
' Specify the file to be embedded.
' Type the correct path name.
.SourceDoc = "C:\Work\monthly report.doc"
' Create the embedded object.
.Action = acOLECreateEmbed
' Optional size adjustment.
.SizeMode = acOLESizeZoom
End With

End If
Exit_dokument_Click:
Exit Sub
Error_dokument_Click:
MsgBox CStr(Err) & " " & Err.Description
Resume Exit_dokument_Click
End Sub

The field containing the dokument is called "dokument" the field containing
company name is called "companyname" I dont know how access can insert the
company name into the template its generated.
 
Back
Top