• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 506
  • Last Modified:

Create a Binary file from a text file via vba

I need vba code to create a binary file from text file

I have a text file..

Pipe delimited format

material_no|alt_material_no_Green
4TM77|4YM42
5E103|5E104
5E081|5E080
2F141|4ZF10
4KK81|4KK82
2F145|2F132
3UM46|4KK77
5A283|4KK77
3W230|4XM33
3W231|4XM35
4W174|4XM37
4W075|4XM39
4W076|4XM43
6W693|4XM57
6W694|4XM59
6W695|4XM61
5E145|5E077

Is there a way to create a binary file from this text format ?


Thanks
0
Fordraiders
Asked:
Fordraiders
  • 8
  • 4
  • 2
  • +2
2 Solutions
 
redmondbCommented:
Hi, fordraiders.

Sure. What format do you want? A sample file would be great!

Thanks,
Brian.
0
 
FordraidersAuthor Commented:
.bin

The file example is in the question part.
0
 
FordraidersAuthor Commented:
sample file attached...

Want it to be in binary format   .bin...
ee-fileexample.txt
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
redmondbCommented:
Thanks, fordraiders.

".bin" doesn't uniquely identify the format - there are lots of different types of ".bin" files. Can you tell you more about it? What will it be input to?

Sorry I didn't make it clear - I am looking for a sample of the output!

Thanks,
Brian.
0
 
Dave BaldwinFixer of ProblemsCommented:
@fordraiders, you didn't give us any details the last time you asked this question.  There are too many possibilities to give you an answer without more information.  What program will use the 'binary' file?
0
 
FordraidersAuthor Commented:
ok...sure will let you know...sorry for the vagness.
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
0
 
FordraidersAuthor Commented:
I will be using Excel 2010 to display the data on a userform.
Right now the text file are large. 2.3gb
Trying to reduce them in size to be more manageable.
0
 
Dave BaldwinFixer of ProblemsCommented:
You don't need to convert them to binary since that actually won't do you any good.  You will probably need to split them into much smaller pieces than 2.3GB.  Here are the specifications for Excel 2010: http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010342495.aspx?CTT=5&origin=HP005199291   Even if you have enough memory and the file fits within the limits,  It will take a very long time to create the display and with a 1,048,576 rows, nobody will take the time to go thru them.

What are you actually trying to do with these files?  There must be a better way than trying to display them in Excel.
0
 
FordraidersAuthor Commented:
i will be querying against the file...not displaying all the data at once.
0
 
FordraidersAuthor Commented:
typing a value into a textbox and displaying the data in a listbox.
0
 
Dave BaldwinFixer of ProblemsCommented:
I think Excel requires you to load that data into a spreadsheet to do anything with it and you may run into the limits built-in to Excel.  You may want to look at using a database like SQL Server Express which is made for searching and sorting large data files.  SQL Server Express is a free download from Microsoft.  You may still be able to use Excel as the front end but without having to wait for the entire file to be loaded.
0
 
FordraidersAuthor Commented:
currently using Access...doing ok...just looking to make a smaller footprint on the backend.
0
 
Dave BaldwinFixer of ProblemsCommented:
Actually I suggest making the big footprint on the backend in SQL Express.  A real SQL server does not have to load the entire database to use it.  You should probably get a much better response.  The key is to take the time to make the appropriate indexes that allow SQL Server to go directly to the data instead of searching through the entire table to find an item.
0
 
[ fanpages ]IT Services ConsultantCommented:
Hi,

I will be using Excel 2010 to display the data on a userform.
Right now the text file are large. 2.3gb
Trying to reduce them in size to be more manageable.

Why not store the data in multiple (&, hence, smaller) text files?

For example,

a) Nine (or Ten, depending on your data) files based on the first character within the "material_no" column (digits 1 to 9, or 0 to 9), or

b) Multiple files grouped by the first two characters within "material_no" (so all data that is prefixed "5L" is in one file, all data prefixed by "5F" is in another, a file for "1A", another file for "4T", & so on).

Then, the Userform you provide can use a textbox & a listbox, or a drop-down listbox, to capture the first character, or first two characters, of a "material_no", locate the correct file (based on filename) & pre-load the content from the appropriate file for selection.

If the user removes a character (or both characters), the available data to select is cleared.

This can also be achieved using a dedicated database, as mentioned above, of course.

BFN,

fp.
0
 
FordraidersAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 8
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now