I am Trying to read data as Bytes from a non Excel File by opening it as Binary and write the same data in Bytes in an excel file through the following VB Program.I am able to Read Successfully from the non Excel file but the data read in Bytes is not getting posted in the Sheet4(Not the Active Sheet) of the Currently Active Excel workbook.I will be thankful if any body help me in this regard.please note that i am new to EXCEL VBA.
Function RWfile (FilePath As String)
Dim Filenumber As Integer
Dim Byet(10) As Byte
Dim I As Integer
Set fso = CreateObject("Scripting.FilesystemObject")
If fso.Fileexists(Filepath) Then
Filenumber = FreeFile
Open Filepath For Binary Access Read Write As #Filenumber
For I = 1 To 10
Get #Filenumber, , Byet(I)
Sheets("Sheet4").Cells(I, 1).Value = (I)Byet
Next I
End If
Close #Filenumber
End Function
Bookmarks