LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Reading binary file

http://www.justlottery.com/dwnld/INDSuperlotto.rtl
http://www.justlottery.com/dwnld/INDThunderball.rtl
http://www.justlottery.com/dwnld/INDFast.rtl

Can anybody help reading the above three binary file in excel through a
vba? The following macro reads the first file but not through Excel
VBA, it reads to Visual Basic.

Can anybody understand the logic of the below code and convert into
Excel macro?

Option Explicit

Private Type TREC
No As Integer
D As Integer
M As Integer
Y As Integer
Numbers(1 To 10) As Integer
End Type


Private Sub Command1_Click()
Const Fle$ = "c:\t\t.rtl"
Dim B(1 To 28) As Byte
Dim Channel%, L9&, L8&, Max&
Dim Rec As TREC


Me.Cls


Channel = FreeFile
Open Fle For Binary Access Read As Channel
' Get 4 byte header - No of lines
Get #Channel, 1, Max&
Me.Print Max
' --- Now the 28 byte records
For L9 = 1 To 10
Get #Channel, , Rec
Disp Rec.No
Disp Rec.D
Disp Rec.M
Me.CurrentX = Me.CurrentX + TextWidth("XX")
Disp Rec.Y
For L8 = 1 To 10
Disp Rec.Numbers(L8)
Next
Me.Print ""
Next


Close #Channel
End Sub


Private Sub Disp(N%)
Dim S$
S$ = Trim$(N)
Me.CurrentX = Me.CurrentX + TextWidth("XXX") _
- TextWidth(S$)
Me.Print S$;
End Sub


Private Sub Form_Load()
Me.AutoRedraw = True
Me.Width = Screen.Width * 0.75
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solver returns non binary answer in binary constrained cells Navy Student Excel Worksheet Functions 6 September 1st 05 03:11 PM
Binary operations (left/right shift, binary and/or, etc.) Mike Hodgson Excel Programming 4 June 17th 05 09:27 AM
read a Unix binary file Arnaud Boëlle Excel Programming 2 April 20th 05 09:24 PM
Help reading binary file Luis[_5_] Excel Programming 2 July 29th 04 05:48 PM
Excel binary file format Rob Bovey Excel Programming 1 November 8th 03 12:04 PM


All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"