Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"get binary" error 458 OLE type not supported in VB

Status
Not open for further replies.

smithles

Programmer
Jul 15, 2002
18
0
0
Thank you in advance for your help.

I have tried a number of variations but all give the same result. Error. apparently nbr 458 I have essentially the same code in another program which works fine.

My system XP VB4


Dim flen&, MAXSTRING&, otstr$, filenameto$
MAXSTRING = 20000
filenameto = "C:\TAMP\TEMP.BIN" ' tried .TMP .MDB also
Open filenameto For Binary As ofp
otstr = ""
otstr = String$(MAXSTRING, 32) ' fill buffer wi blanx
Get ofp, 1, otstr ' was ofp
' the message says "Variable uses an OLE type not supported in Visual Basic"

I don't care if it is not supported in VB I want to read it in binary, it is MY problem. I can alter the file "type" if it will help. The data to "get" has correct contents and is the expected size (>MAXSTRING).

If I replace the "get" by a "put", the data changes then crashes before the next line executes.
 
Not very helpful, but the above code works for me when I add
ofp = FreeFile
 
Hi.
sorry, left off that statement which is present in real prog.
les
 
Thankyou for looking at this but the problem was mine, of course.

I had included two consecutive statements "freefile ifp
freefile ofp" without an intervening "open" so both were assigned the same file nbr. closing one (just prior to the shown code)released the assigned file nbr, so the error trap with misleading complaint when the supposed second file was referenced.

Les
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top