The function is passed a string path/file. The call is supposed to convert a cvs document into an xls. It works except for saving the file. I don't see the saved file anywhere. Thoughts?
Public Sub ConvertCSVtoXL(strCSVPath As String)
Dim appExcel As Excel.Application
Dim Pathfile As String
'Switch to Microsoft Excel so it won't go away when you finish.
On Error Resume Next
AppActivate "Microsoft Excel"
'Get an Application object so you can automate Excel.
Set appExcel = GetObject(, "Excel.Application")
Pathfile = Left(strCSVPath, Len(strCSVPath) - 3) & "xls"
With appExcel
.Workbooks.Open FileName:=strCSVPath
ActiveWorkbook.SaveAs FileName:=Pathfile, FileFormat:=xlNormal
End With
appExcel.Quit
Set appExcel = Nothing
MsgBox "File '" & strCSVPath & "' has been converted to excel under the same " & _
"filename with an XLS extension"
End Sub
Public Sub ConvertCSVtoXL(strCSVPath As String)
Dim appExcel As Excel.Application
Dim Pathfile As String
'Switch to Microsoft Excel so it won't go away when you finish.
On Error Resume Next
AppActivate "Microsoft Excel"
'Get an Application object so you can automate Excel.
Set appExcel = GetObject(, "Excel.Application")
Pathfile = Left(strCSVPath, Len(strCSVPath) - 3) & "xls"
With appExcel
.Workbooks.Open FileName:=strCSVPath
ActiveWorkbook.SaveAs FileName:=Pathfile, FileFormat:=xlNormal
End With
appExcel.Quit
Set appExcel = Nothing
MsgBox "File '" & strCSVPath & "' has been converted to excel under the same " & _
"filename with an XLS extension"
End Sub