Opening a Word doc embedded in an Access OLE field

  • Thread starter Thread starter Mike375
  • Start date Start date
M

Mike375

Guest
(Resolved) Opening a Word doc embedded in an Access OLE field

Does anyone have any code that will open a Word doc embedded (not linked) in an Access OLE field.

I have about a dozen pre prepared Word letters that I want embedded so the DB is not reliant on the letters being stored in a folder as Word docs.

I have been unable to find anyhting that will open them. I figure if I have the code that will open from the Access OLE field then I can add the rest to insert into bookmarks etc or have them transfer to a folder and pick it up from there.

Office 2003 and both XP and Vista
 
Last edited:
Here is a method I have but if you change focus from the opened Word doc the Document will disappear. I am currently working on this by disabling the controls on the Access Form that has the control to open the doc. There is also a problem to show this embedded Word document as an Icon in a Bound Frame Object. If you add the document manually the Icon will show. If you add the document programmatically the document will show up as a text: "Microsoft Word Document" in the frame.

Private Sub cmdOpenTCEQdoc_Click()
On Error GoTo Err_cmdOpenTCEQdoc_Click
Dim sFileName As String
Dim sPathFileName As String

Dim intX As Integer, intNumVerbs As Integer
Dim strVerbList As String
Dim wddoc As Word.Document
Dim rst As ADODB.Recordset
Dim strSQL As String


If IsNull(TCEQFORM.Value) Then
sFileName = "New_TCEQ_BLANK_FORM.doc"
sPathFileName = Application.CurrentProject.Path & "\" & sFileName

'This works but does not display icon
'TCEQFORM.Class = "???? Don't Know"
TCEQFORM.SourceDoc = sPathFileName
TCEQFORM.DisplayType = acOLEDisplayIcon
TCEQFORM.OLETypeAllowed = acOLEEmbedded
TCEQFORM.Action = acOLECreateEmbed
End If

With TCEQFORM
.Verb = acOLEVerbOpen
.Action = acOLEActivate
End With

Set wddoc = TCEQFORM.Object
 

Users who are viewing this thread

Back
Top Bottom