+ Reply to Thread
Results 1 to 3 of 3

Macros to extract specific values from a .DAT file

  1. #1
    Registered User
    Join Date
    06-21-2013
    Location
    Lafayette, LA
    MS-Off Ver
    2010
    Posts
    2

    Question Macros to extract specific values from a .DAT file

    I'm currently undertaking a project on my own, in which a tool creates a .DAT file with a ton of channel values, in a pretty complicated format when opened with notepad.

    What i'm trying to figure out how to do is:

    1. create a button that allows me to browse on my computer and select the specific file I want to import.

    2. Create ( a macro maybe?) that will pull out specific values out of this .dat file which, I believe, are always in the same place regardless of which tool produced them.

    3. Determine whether these values fall within a tolerance, and have and adjacent cell reading good/bad and color coded Green/Red for within and outside of the tolerance respectively.

    I'm pretty much a macro n00b. I could do #3 pretty easily. It's the button creation and being able to locate the specific values in the .DAT file and assigning it to a cell that I'm having trouble figuring out. Any tutorials, reading materials, advice, videos, or anything would be immensely helpful.

    Apologies for my terrible punctuation and grammar.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Macros to extract specific values from a .DAT file

    Record a macro importing one of the Dat files.

    From the VBE, look up getopenfilename.

    Change the Path and extension from the example to the dat extension.

    It might look something like this.
    Please Login or Register  to view this content.
    If the import puts the tolerance in the same place, then you should be able to use autofilter to narrow the list down.

    If you need anything more specific, then you'll need to post a workbook and a DAT file.

    Is see you're from Lafayette. I lived there for a year, then down to New Iberia for three more. I worked at Pelican Aviation. many, many years ago now.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    06-21-2013
    Location
    Lafayette, LA
    MS-Off Ver
    2010
    Posts
    2

    Re: Macros to extract specific values from a .DAT file

    Thanks for the post! I am no able to browse for the document, but when i select "open" i get this error:


    'Runtime error 1004'

    and the debugger highlights .Refresh BackgroundQuery:=False


    And here is my code i have so far.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 06-22-2013 at 03:29 PM. Reason: Added Code Tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1