Export all but certain excel sheets to CSV via VBA? -


based on other stuff found here, have made following script want. export 4 specific sheets in excel file csv files, append dates them, , save them dated folders. problem renames sheets exported in original processing file. how can rectify this?

sub savelcpworksheetsascsv()  dim ws excel.worksheet dim savetodirectory string  dim currentworkbook string dim currentformat long  currentworkbook = thisworkbook.fullname currentformat = thisworkbook.fileformat ' store current details workbook    savetodirectory = "c:\test\" & format(date - 1, "yyyymm") & "\"    if len(dir(savetodirectory, vbdirectory)) = 0     mkdir savetodirectory   end if    each ws in thisworkbook.worksheets     if ws.name <> "input" , ws.name <> "ref" , ws.name <> "total" , ws.name <> "affected accounts"         ws.saveas savetodirectory & ws.name & "_" & format(date - 1, "yyyymmdd"), xlcsv     end if   next   application.displayalerts = false   thisworkbook.saveas filename:=currentworkbook, fileformat:=currentformat  application.displayalerts = true ' temporarily turn alerts off prevent user being prompted '  overwriting original file.  end sub 

sub tester()  dim ws worksheet, wb workbook      each ws in thisworkbook.worksheets         ws.copy 'creates new workbook         activeworkbook             .saveas "c:\temp\" & ws.name & "_blah.csv", xlcsv             .close false         end     next ws  end sub 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -