+ Reply to Thread
Results 1 to 11 of 11

Saving CSV file and sending to a folder over and over again

Hybrid View

  1. #1
    Registered User
    Join Date
    12-12-2003
    Posts
    79

    Saving CSV file and sending to a folder over and over again

    Thanks for any help in advance

    I have this code

    Sub save_file_as()
    Sheets("CSV").Select
            ActiveWorkbook.SaveAs Filename:= _
            Range("'MATCH SETUP'!B34").Value & ".csv", FileFormat:= _
            xlCSV
              Sheets("Calculator").Select
    End Sub
    so when i run this macro it saves the sheet caleed CSV as CSV file as a name from another sheet which changes all the time,, this works ok

    however my problem is this only works once because when i run the macro again it cant find the Sheet called CSV anymore because it has renamed it from the previous running of the macro

    so i need to be able to run the macro whenever i want over and over again

    also it would be good not only could i save it by running the macro via a form button but also say it saves itself every 10 seconds, that would be a bonus

    hope ive explained it well


    thanks
    scott
    Last edited by scottymelloty; 01-14-2009 at 08:57 AM.

  2. #2
    Registered User
    Join Date
    12-12-2003
    Posts
    79
    If anybody has another way of doing it that would be good as well

    i need the CSV sheet saving as a csv file to the path and name set in cell 'MATCH SETUP'!B34 , this cell name will change ie it will put the time it is saved in the name

    so i need to save that file on demand when running the macro and hopefully say every 10 seconds as well (but that bit could wait)


    maybe it could open a blank workwook, paste the data from CSV sheet onto the new workbook then save and send that new work book as a csv file to the path ,, maybe thats even more complicated !!

    any ideas the less complicated the better would be good


    thanks very much

    scott

  3. #3
    Registered User
    Join Date
    12-12-2003
    Posts
    79
    I Have attached a file to show what i mean if it helps

    you will have to change the path name on the MATCH SETUP tab in cell B32 so it can save somewhere on your own computer to test

    so on the Calculator Sheet when you press that button it will save the datat on CSV sheet as a CSV file to the path specified which is what i want

    however when you rpess the button again it dosnt like it because the sheet CSV dosnt exist anymore because it has been overwritten with a new name from the csv file last saved
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-12-2003
    Posts
    79
    any ideas anyone ? could do with some help or a pointer in the right direction please

  5. #5
    Registered User
    Join Date
    12-12-2003
    Posts
    79
    help

    any code to change a worksheet name back to original name would help

    thanks

  6. #6
    Registered User
    Join Date
    12-12-2003
    Posts
    79
    ok ive taken itrom a differnet angle using some code ive found and changed a bit this works nicely wiht one exception,, it creates a copy of all the worksheets in my workbook

    i woul dlike it to just copy one of the worksheets in my workbook , in this case the worksheet called CSV

    What do i need to change ?

    Sub Copysheet()
        Dim sht As Worksheet
        Dim NFName As String
        Const WBPath = "C:\Users\Scott\Documents\"
    
        For Each sht In ActiveWorkbook.Worksheets
            sht.Copy
            NFName = WBPath & sht.Name & ".csv"
            ActiveWorkbook.SaveAs Filename:=NFName, _
              FileFormat:=xlCSV, CreateBackup:=False
            ActiveWindow.Close
        Next
    End Sub
    thanks

+ 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