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?
 
Top