Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Import binary file and convert to HEX data | Excel Programming | |||
Read Binary | Excel Programming | |||
Solver returns non binary answer in binary constrained cells | Excel Worksheet Functions | |||
read a Unix binary file | Excel Programming | |||
How can I read/write file with binary format??? | Excel Programming |