![]() |
How to read data from binary file?
Hello Guys!
Such a question to you I have a binary file. I need to get from this file data in 100 byte to cell and after I need to create a new binary empty file and unload it received data from the first binary file. Thanks for you time. Regards Valery. |
How to read data from binary file?
A tutorial at this web page might get you started, or at least be helpful: http://www.developerfusion.co.uk/show/85/1/ Hope this helps. "Valery" wrote: Hello Guys! Such a question to you I have a binary file. I need to get from this file data in 100 byte to cell and after I need to create a new binary empty file and unload it received data from the first binary file. Thanks for you time. Regards Valery. |
How to read data from binary file?
You don't have to put any data into a worksheet. You can open two files and
move data from one file to the second file Sub fixevents() Const ForReading = 1, ForWriting = 2, _ ForAppending = 3 Set fs = CreateObject("Scripting.FileSystemObject") fileToOpen = Application _ .GetOpenFilename("Binary Files (*.bin), *.bin", _ Title:="Read File") If fileToOpen = False Then MsgBox ("Cannot Open File - Exiting Sub") End If Set fin = fs.OpenTextFile(fileToOpen, _ ForReading, TristateFalse) fileToOpen = Application _ .GetOpenFilename("Binary Files (*.bin), *.bin", _ Title:="Write File") If fileToOpen = False Then MsgBox ("Cannot Open File - Exiting Sub") End If Set fout = fs.CreateTextFile _ (fileToOpen, True) Do While fin.AtEndOfStream < True readdata = fin.Read(Characters) fin.write readdata Loop fin.Close fout.Close End Sub "XP" wrote: A tutorial at this web page might get you started, or at least be helpful: http://www.developerfusion.co.uk/show/85/1/ Hope this helps. "Valery" wrote: Hello Guys! Such a question to you I have a binary file. I need to get from this file data in 100 byte to cell and after I need to create a new binary empty file and unload it received data from the first binary file. Thanks for you time. Regards Valery. |
How to read data from binary file?
Joel Thanks !
Help me please one more I need the open file without dialog box it's possible ? in second i would read data from binary file , put in cell 100 byte in some cell on the sheet And after unload 100 to a new binary file from cell Thanks for you time. "Joel" wrote: You don't have to put any data into a worksheet. You can open two files and move data from one file to the second file Sub fixevents() Const ForReading = 1, ForWriting = 2, _ ForAppending = 3 Set fs = CreateObject("Scripting.FileSystemObject") fileToOpen = Application _ .GetOpenFilename("Binary Files (*.bin), *.bin", _ Title:="Read File") If fileToOpen = False Then MsgBox ("Cannot Open File - Exiting Sub") End If Set fin = fs.OpenTextFile(fileToOpen, _ ForReading, TristateFalse) fileToOpen = Application _ .GetOpenFilename("Binary Files (*.bin), *.bin", _ Title:="Write File") If fileToOpen = False Then MsgBox ("Cannot Open File - Exiting Sub") End If Set fout = fs.CreateTextFile _ (fileToOpen, True) Do While fin.AtEndOfStream < True readdata = fin.Read(Characters) fin.write readdata Loop fin.Close fout.Close End Sub "XP" wrote: A tutorial at this web page might get you started, or at least be helpful: http://www.developerfusion.co.uk/show/85/1/ Hope this helps. "Valery" wrote: Hello Guys! Such a question to you I have a binary file. I need to get from this file data in 100 byte to cell and after I need to create a new binary empty file and unload it received data from the first binary file. Thanks for you time. Regards Valery. |
How to read data from binary file?
from Set fout = fs.CreateTextFile _ (fileToOpen, True) Set fin = fs.OpenTextFile(fileToOpen, _ ForReading, TristateFalse) to fileToOpen = "c:\temp\book1.xls" Set fout = fs.CreateTextFile _ (fileToOpen, True) fileToOpen = "c:\temp\book2.xls" Set fin = fs.OpenTextFile(fileToOpen, _ ForReading, TristateFalse) "Valery" wrote: Joel Thanks ! Help me please one more I need the open file without dialog box it's possible ? in second i would read data from binary file , put in cell 100 byte in some cell on the sheet And after unload 100 to a new binary file from cell Thanks for you time. "Joel" wrote: You don't have to put any data into a worksheet. You can open two files and move data from one file to the second file Sub fixevents() Const ForReading = 1, ForWriting = 2, _ ForAppending = 3 Set fs = CreateObject("Scripting.FileSystemObject") fileToOpen = Application _ .GetOpenFilename("Binary Files (*.bin), *.bin", _ Title:="Read File") If fileToOpen = False Then MsgBox ("Cannot Open File - Exiting Sub") End If Set fin = fs.OpenTextFile(fileToOpen, _ ForReading, TristateFalse) fileToOpen = Application _ .GetOpenFilename("Binary Files (*.bin), *.bin", _ Title:="Write File") If fileToOpen = False Then MsgBox ("Cannot Open File - Exiting Sub") End If Set fout = fs.CreateTextFile _ (fileToOpen, True) Do While fin.AtEndOfStream < True readdata = fin.Read(Characters) fin.write readdata Loop fin.Close fout.Close End Sub "XP" wrote: A tutorial at this web page might get you started, or at least be helpful: http://www.developerfusion.co.uk/show/85/1/ Hope this helps. "Valery" wrote: Hello Guys! Such a question to you I have a binary file. I need to get from this file data in 100 byte to cell and after I need to create a new binary empty file and unload it received data from the first binary file. Thanks for you time. Regards Valery. |
All times are GMT +1. The time now is 05:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com