Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embed Word template for each record?

Status
Not open for further replies.

rleestma

Technical User
Jul 31, 2001
99
US
hi there...

I would like to figure out a way to embed a word document into a field that is drawn from a template... For instance, a user can press a button, and then the associated word document will come up, edits can be made and saved into that specific record, and the user can return back to the record form...

Ideas?

Thanks,

Ry
 
Two ways:

Create a new field and make the data type OLE Object. Go to the field and from the tools menu choose insert/object. Check the create from file radio button and follow the wizard.

Another way is to store the paths in a table and use VB to launce word, like below. This looks a a textbox on a form called txtFile, which is bound to a table that stores the filename & path.

'Display a word document based on variables in a form
Private Sub cmdJobDesc_Click()
'Dim objects and variables
Dim objWord As Object
Dim File
'Set file path & name, stored in tblTitle
File = Me.txtFile
'Make sure there's something there
If File <> &quot;-&quot; Then 'In the table, I stored a hyphen instead of having nulls
'Launch word
Set objWord = New Word.Application
With objWord
'Open the file
.Documents.Open FileName:=Chr(34) & File & Chr(34) ' Note the chr(34) to prevent problems with &quot;&quot;
'Make it visible
.Visible = True
End With
'Maximize the window
objWord.Application.WindowState = wdWindowStateMaximize
Else
'more code down here.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top