Calling embedded word documents

  • Thread starter Thread starter leverenz
  • Start date Start date
L

leverenz

Guest
I have embedded several Word Documents (for mail merges) as OLE objects within a database. How in VB do I call up one of these Word documents (or any OLE objects)?
 
I've only got half way:

Assumption: OLE-objects are in a certain field in a certain table.

Then:

sub openObjectInWord()
Dim oWord As Word.Application
Dim dbCurr As Database
Dim rs As Recordset
Dim oOLE As Object

Set dbCurr = currentDB
Set rs = dbCurr.OpenRecordset("MyTable")
rs.FindFirst "ID=" & lngIDtoBeSelected
Set oOLE = rs("AppropriateFieldName")
' oOLE contains now the OLE-object (pointer to Word-doc)

' now opening word
Set oWord = CreateObject("Word.Application")

' but this doesn't work (but requires a filename):
' oWord.Documents.Open oOLE

Exit_:
oWord.Visible
Set oWord = Nothing
Set rs = Nothing
Set dbCurr = Nothing

End Sub


Hope, we can get further!
 

Users who are viewing this thread

Back
Top Bottom