This isn't exactly what you're looking for but it might give you some ideas. I had several thousand OLE objects that I wanted to convert from an Access 97 db into Word documents on a hard drive. Here's the code that worked for me...Good luck! emijohns
Sub CopyDocument_Click()
Dim NewObject As Object
Dim NewDoc As String
Dim DocPath As String
' Name of the new document to create.
NewDoc = "ASL" & Me![AuditID]
' Where to store the new document.
' DefaultDir$(9) returns the Word directory path.
' See DefaultDir$() in Word's on-line help for more options.
' Note: The "$" is not used when calling DefaultDir via
' OLE Automation.
DocPath = "D:\Temp"
' Copies the embedded object to Clipboard.
Me![SmryLetter].Verb = 0
Me![SmryLetter].Action = 7
Me![SmryLetter].Object.App
Me![SmryLetter].Object.App
Me![SmryLetter].Action = 9
DoEvents
' Creates a new document and pastes Clipboard contents.
' Saves the document in the Word directory and closes the
' document.
Set NewObject = CreateObject("Word.Basic")
NewObject.FileNew
NewObject.EditPaste
NewObject.FileSaveAs DocPath & "\" & NewDoc
NewObject.FileClose
' Frees the memory used by the objects.
Set NewObject = Nothing
MsgBox DocPath & "\" & NewDoc & " was created successfully."
End Sub
Main Topics
Browse All Topics





by: eagle1357Posted on 2003-10-06 at 12:33:46ID: 9500493
I'm not certain, but I think you're wanting to take the data from the OLE field in the table and output it to a file? If so you can make a small VBA function to do it for you. Here is a small code snippet to try:
y Table", dbOpenDynaset) ' open the table
Sub getitout()
Dim strTemp As String
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("M
With rst
'Get to the record in question
strTemp = !oleFieldName
End With
Open "C:\pic.bmp" For Binary As #1
Put #1, 1, strTemp
Close #1
End Sub
Hopefully that helps point you in the right direction. If you need more let me know.