Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
I'm trying to process all my .csv files in directory using VBA Marco. My intention is to process all files and save them (with the same file names) into another directory as .xls. The problem is that saving as .xls does not work. My macro looks like this
<o></o>
<o>
</o>Your help is much appreciated<o></o>
<o></o>
Larus<o></o>
<o></o>
I'm trying to process all my .csv files in directory using VBA Marco. My intention is to process all files and save them (with the same file names) into another directory as .xls. The problem is that saving as .xls does not work. My macro looks like this
<o></o>
<o>
Rich (BB code):
Sub ProcessAllFiles()<o:p></o:p>
Dim sFile As String<o:p></o:p>
Const sPath As String = "C:\Temp\Excel\"<o:p></o:p>
<o:p></o:p>
sFile = Dir(sPath & "*.csv")<o:p></o:p>
<o:p></o:p>
Do While sFile <> ""<o:p></o:p>
<o:p></o:p>
Workbooks.Open (sPath & sFile)<o:p></o:p>
result = ActiveWorkbook.Name<o:p></o:p>
<o:p></o:p>
Call Modifaction_macro<o:p></o:p>
<o:p></o:p>
ActiveWorkbook.SaveAs _<o:p></o:p>
Filename:="C:\Temp\Excel\Processed\" + result + ".xls", _<o:p></o:p>
FileFormat:=xlWorkbookNormal<o:p></o:p>
<o:p></o:p>
<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:place w:st="on">Loop</st1:place><o:p></o:p>
End Sub<o:p></o:p>
<o></o>
Larus<o></o>