FunctionSaveAllSheetsAsCSV(outputPathAsString) |
OnErrorGoToHeaven |
' each sheet reference |
DimSheetAsWorksheet |
' path to output to |
'Dim outputPath As String |
' name of each csv |
DimOutputFileAsString |
Application.ScreenUpdating=False |
Application.DisplayAlerts=False |
Application.EnableEvents=False |
' ask the user where to save |
'outputPath = '.' 'InputBox('Enter a directory to save to', 'Save to directory', Path) |
IfoutputPath<>'Then |
' save for each sheet |
ForEachSheetInSheets |
OutputFile=outputPath&Replace(ActiveWorkbook.Name,'.xls','-')&Sheet.Name&'.csv' |
' make a copy to create a new book with this sheet |
' otherwise you will always only get the first sheet |
Sheet.Copy |
' this copy will now become active |
ActiveWorkbook.SaveAsFilename:=OutputFile,FileFormat:=xlCSV,CreateBackup:=False |
ActiveWorkbook.Closesavechanges:=False |
Next |
EndIf |
Finally: |
Application.ScreenUpdating=True |
Application.DisplayAlerts=True |
Application.EnableEvents=True |
ExitFunction |
Heaven: |
MsgBox'Couldn't save all sheets to CSV.'&vbCrLf&_ |
'Source: '&Err.Source&' '&vbCrLf&_ |
'Number: '&Err.Number&' '&vbCrLf&_ |
'Description: '&Err.Description&' '&vbCrLf |
GoToFinally |
EndFunction |
FunctionFileList(fldrAsString,OptionalfltrAsString='*.xls')AsVariant |
DimsTempAsString,sHldrAsString |
IfRight$(fldr,1)<>Application.PathSeparatorThenfldr=fldr&Application.PathSeparator |
sTemp=Dir(fldr&filtr) |
IfsTemp='Then |
FileList=False |
ExitFunction |
EndIf |
Do |
sHldr=Dir |
IfsHldr='ThenExitDo |
sTemp=sTemp&' '&sHldr |
Loop |
FileList=Split(sTemp,' ') |
EndFunction |
SubConvert_Files_To_CSV() |
strOrigFile=ActiveWorkbook.Name |
Debug.Print'Current dir '&ActiveWorkbook.FullName |
DiminputPathAsString |
inputPath='Macintosh HD:Users:me:Desktop:dirWithXlsFiles' |
IfRight$(inputPath,1)<>Application.PathSeparatorTheninputPath=inputPath&Application.PathSeparator |
Debug.Print'input path'&inputPath |
' output directory |
DimoutputPathAsString |
outputPath=inputPath&'csv' |
DimiTempAsInteger |
OnErrorResumeNext |
iTemp=GetAttr(outputPath) |
SelectCaseErr.Number |
CaseIs=0 |
FileOrDirExists=True |
CaseElse |
FileOrDirExists=False |
MkDiroutputPath |
EndSelect |
IfRight$(outputPath,1)<>Application.PathSeparatorThenoutputPath=outputPath&Application.PathSeparator |
DimlistPaths |
listPaths=FileList(inputPath) |
Dimres |
IfTypeName(listPaths)<>'Boolean'Then |
Fori=LBound(listPaths)ToUBound(listPaths) |
Debug.Print'-----------------------------------------------------' |
Debug.PrintlistPaths(i) |
Workbooks.OpeninputPath&listPaths(i) |
strCurrentWBName=ActiveWorkbook.Name |
IfstrOrigFile<>strCurrentWBNameThen |
res=SaveAllSheetsAsCSV(outputPath) |
Windows(strCurrentWBName).Close |
EndIf |
Next |
Else |
MsgBox'No files found' |
EndIf |
EndSub |
Human: fall flat official soundtrack. Volvo penta aq125a specs. In just a few clicks, you’ll be able to download your entire address book to a CSV that’s importable anywhere that accepts the file - Excel, Google Docs, Pages (on Mac), etc. Robinhood is only licensed to sell securities in the United States (US), to US citizens and residents, and will not permit anyone who is not a legal US resident to purchase or sell securities through its application until such time as it is approved to engage in the securities and investment business by the appropriate regulator(s) of a foreign jurisdiction.