+ Reply to Thread
Results 1 to 6 of 6

Outputting data that is constantly overwritten

  1. #1
    Registered User
    Join Date
    03-28-2007
    Posts
    6

    Outputting data that is constantly overwritten

    Hi all,

    First post here. I have imaging software that outputs data to an Excel file (lets call it SheetA) for every frame. The problem is that sheet A is overwritten every frame, and I need to find a way of outputting the data to another excel file, or text file, (lets call it sheet B) such that every time the data in sheet A changes, this is copied to sheet B, giving me a record of the output over time.

    I'm am very new to macros and VB, and this problem has me stumped. If anyone can tell me if this is possible, it would be much appreciated.

    Thanks,

    Zaphius

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    What you have described sounds possible providing the workbook is opened - using a worksheet change macro

    If the workbook is not open then would need to know how often sheetA is updated by the software as would probally need to run a OnTime macro

    Need to know what cells on sheetA needs to be monitered for change & what needs to be copied to sheet B
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    03-28-2007
    Posts
    6
    Thanks for the relpy mudraker. Have decided to take another approach for this problem. I can get the camera to output text files. The text files will be 500 entries long. Every 500 entries, a new text file is started. The name of these text files is along the lines of "name_yyyy mm dd_hh:mm:ss.txt" I have used the Data > Get external Data > Import text file function, set to import the file and update every 1 minute.

    My problem is that every minute or so, a new text file is written. Is there a way to set this up so that the most recent text file in a specified folder is imported every minute.

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    This macro cycles thrugh a folder to get the file name of the latest file based on file stamp time - It is not based the date & time which is included in the file name


    Please Login or Register  to view this content.
    The variable sNewest should be able to be incorporated into your query.

    It is possible that as more files are created it will slow the macro down & the files will need to be moved to another folder or deleted. This can be done via VBA

  5. #5
    Registered User
    Join Date
    03-28-2007
    Posts
    6
    Thankyou Mudraker, you are being most helpful

    This code is working very well. Outputs the filename I am after. I am, however, still very much a noob. If I may, a few more questions.

    I have two text files I am pulling into the spreadsheet. One for Intensity, another for ColourSpeck.

    I have set the code up twice and renamed sNewest to Intensity and ColourSpeck.

    I am lost when it comes to incorporating this macro in order to import the files I am looking for. I had been trying to use the

    Data>Get External Data>Import Text files
    and have also tried setting up a query using New Database Query

    How do I run this Macro as the input for the query.

    What I need to do is use the text file names to import the newest file every minute, overwriting the old file.

    If you can help, it will be much appreciated, and thanks again for being so helpful so far.

    Zaphius

  6. #6
    Registered User
    Join Date
    03-28-2007
    Posts
    6
    I think I'm getting closer. I have modified code from h$$p://www_cpearson_com/Excel/imptext.htm and ended up with this:

    Please Login or Register  to view this content.

    All I need now is a way of setting the

    SaveColNdx = ActiveCell.Column
    RowNdx = ActiveCell.Row

    to a specific cell on a specific sheet. Then I need to set up a macro with a time loop that will repeat every x minutes. It has to:

    1. delete all existing data in range on the "Intensity Import" and "Colour Spec Import" spreadsheets.
    2. Run IntensityNewestFile Macro
    3. Run ColourSpeckNewestFile Macro
    4. Calculate all sheets ("Intensity Import", "Colour Spec Import" "Input and Output" and "Filter")
    5. Pause x minutes
    6. Repeat

    If you can help, I will be indebted for life. This is the first time I've ever tried using macros in Excel, and I think I've bitten off more than I can chew.

    Cheers,


    Zaphius

+ 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