The only way I know to do this is to save the embedded document out to an external folder. Review http://blogs.office.com/b/microsoft-...ent-field.aspx
Instead of the line calling Windows Explorer to open the document, use code that creates a Word object and manipulate the object. Here is one example:
http://answers.microsoft.com/en-us/o...1-c317123b29ce
This code worked for me:
Code:
Public Sub TestOpenFirstAttachmentAsTempFile()
Dim rst As DAO.Recordset
Dim rstChild As DAO.Recordset2
Dim fldAttach As DAO.Field2
Dim strFilePath As String
Dim strTempDir As String
Set rst = CurrentDb.OpenRecordset("SELECT Document FROM Airports WHERE FAAID='6K8';")
strTempDir = CurrentProject.Path
If Right(strTempDir, 1) <> "\" Then strTempDir = strTempDir & "\" ' Make sure the path always ends with a backslash.
Set rstChild = rst!Document.Value ' the .Value for a complex field returns the underlying recordset.
strFilePath = strTempDir & rstChild!FileName ' Append the name of the first (and only) attached file to temp dir.
If Dir(strFilePath) <> "" Then ' the file already exists--delete it first.
VBA.SetAttr strFilePath, vbNormal ' remove any file attributes (e.g. read-only) that would block the kill command.
VBA.Kill strFilePath ' delete the file.
End If
Set fldAttach = rstChild!FileData ' The binary data of the file.
fldAttach.SaveToFile strFilePath
rstChild.Close ' cleanup
With CreateObject("Word.Application")
With .Documents.Open(strFilePath)
.PrintOut
.Close False
End With
.Quit
End With
Kill strFilePath
End Sub