Exporting an Embedded Object

I

Imran

Hi all,

I have a form which has basic functionality for adding (embedding) a file
into the database, changing or removing a file from the database. I would
like to add functionality to export the file that belongs to the record being
viewed. I am using this code which first determines (based on the full
filename) the extension of the file (i.e. .xls, .doc etc.). Then based on the
extension, the code needs to perform the functions required for saving that
type of document.

Private Sub exportFile(xFile As String)

Dim fExt As String
Dim exObj As Object
Dim savePath As String

fExt = extractFileExtension(xFile)

savePath = "C:\Documents and Settings\My Documents\File." & fExt
Me.oleFile.Action = acOLEActivate

Select Case fExt
Case "xls"
Set exObj = GetObject(, "Excel.Application")
exObj.Workbooks(1).SaveAs savePath
Form_Documents.ActiveControl = True

exObj.Quit
Case "doc" ..etc

Case Else
MsgBox "Application cannot be determined"

End Select
End Sub

Any ideas or help?

Many Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top