format problem when extracting ole object field to a file

T

thread

Hi all,

I'm trying to export ole object field to an excel file,the issue is
that the format is currapted when extracting the data to the file.
i assume i'm doing something wrong,this is my code:
Dim a() As Byte
Dim lngOLEValue As Long
Dim lngFN As Long
Dim strTemp As String

lngFN = FreeFile()
lngOLEValue = LenB(DLookup("[excel]", "table1", "ID = 1"))
ReDim a(0 To lngOLEValue) ' should be -1
' Copy the contents of the OLE field to our byte array
a = DLookup("[excel]", "table1", "ID = 1")
strTemp = "c:\OLEfieldTestExcel" & ".xls"
Open strTemp For Binary Access Write As #lngFN
Put #lngFN, , a
Close #lngFN

do anyone have an idea what is going wrong?
 

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