• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to read data from dat files and write in to excel worksheet with vba

Greetings Q: How to read data from dat files and write in to excel worksheet using vba

Is it possible to read data from dat file/files and write in to excel worksheet with vba.
If Yes, the requirement I'm trying to make it is

User will have to enter a number in search field in user form (Search Records User Form in spreadsheet from atatchment)and click ok.
Need a macro to look/find for this entered number in dat files(this can be a single file or 10 files in same folder) and if finds a match in a comma delimited(semicolon is the end of record as given in example) then this record need to be copied in to worksheet.

Attaching the example data with this thread (DATtoWORKSHEETPrototype.zip)

Please let me know if any one has solution with a macro for above requirement.
Appreciate all the help.

Regards,
Mahindra
 

Attachments

  • DATtoWORKSHEETPrototype.zip
    19.2 KB · Views: 12
Hi,

While some DAT files can be opened directly, most contain program data that is referenced the program when it is running. Therefore, most DAT files are not meant to be opened manually. Since ".dat" is a generic extension, it may be used by multiple programs. This can make it difficult to know how to open a DAT file.

http://pc.net/extensions/file/dat

I am not able to open the attached DAT files too.
 
In this case these dat files do come to destination and no program runs as this data is final output data from multiple sources.

These dat files I'am able to open in a notepad, not sure if u can not open.
The data in this dat file is failrly in readable format.

Try to open the file in note pad and I believe you can see the sample data.
 
But i am unable to understand that what will be input for search box & where it will be find in text file.

Pls explain then same.
 
the input for search box would be number (1113265055 for example) and this would be fifth field in dat files and this number might be in multiple dat files.
if system finds this number then it needs to copy the entire row (identifier for end of row would be semi colon ";" in BID1 tab.
at the end if you have say 10 records that matches with this search number all the 10 entries need to be in BID tab with data filled in corresponding columns.
 
Last edited by a moderator:
Back
Top