+ Reply to Thread
Results 1 to 2 of 2

Save live data to CSV

  1. #1
    Registered User
    Join Date
    11-11-2014
    Location
    Capetown, South Africa
    MS-Off Ver
    10
    Posts
    1

    Save live data to CSV

    For starters - I am raw and have limited skills, thus the guidance here is important to me. We have to supply data to a 3rd party in CSV format. The data must be updated at frequent intervals with a timestamp. Some workbooks at 1 minute intervals and other at 30/60 minute intervals. To ensure that data is permanently available I have done a little batch file to start the excel file. Our normal method of collecting data is via excel. I am able to get the data to update at at frequent intervals (10 seconds) courtesy Mr Google with a macro. The Macro also starts automatically on open event.
    [Code start]
    Private Sub Workbook_Open()
    Range("A1:A1").Calculate
    Application.OnTime DateAdd("s", 10, Now), "Calculate_Range"

    End Sub
    [Code End]
    I have however run into issues when trying to save this to CSV file - the guidelines found thus far does not help me to have this process run unattended. I have managed to get past the overwrite query, but when I tried the format acknowledgement it fails.
    [Code Start]
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.Run "VBATest.xlsm!Calculate_Range"
    ChDir "E:\PI"
    ActiveWorkbook.SaveAs Filename:="E:\PI\VBATest01.xlcsv", FileFormat:=xlCSV, _
    CreateBackup:=False
    Application.Run "VBATest.xlsm!Calculate_Range"

    End Sub
    [Code End]
    What I need to accomplish is to:
    1. Run the excel file automatically - the batch file can be added to scheduler to restart this.
    2. Update the values at preset intervals - the macro I have now, can run this.
    3. Save sheet as CSV file automatically without intervention required (overwrite and format compatibility).
    4. Restart the excel file and repeat process - batch file in scheduler if there is no other better method.
    Last edited by djvol; 10-22-2020 at 05:01 AM. Reason: Code marker

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,445

    Re: Save live data to CSV

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however, you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Live graphing comparing manually entered data with existing data
    By Desert Coyote in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 05-15-2015, 03:05 PM
  2. save live feed data to another sheet every 5 min
    By paulkhan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2014, 05:24 AM
  3. save live feed data to another sheet every 5 min
    By paulkhan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2014, 09:40 PM
  4. Excel Live VLookup Live in spreadsheet - Quick way to find them?
    By CHR15T1N4 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-31-2013, 07:33 AM
  5. How to save Live Data in Excel
    By wallstreetballa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-30-2012, 08:46 PM
  6. Getting live data from the web - HELP
    By Scottish_Kris in forum Excel General
    Replies: 1
    Last Post: 12-26-2012, 04:28 PM
  7. Help With Using Live Data - DDE
    By kylewc in forum Excel General
    Replies: 0
    Last Post: 02-07-2006, 10:23 AM

Tags for this Thread

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