EDN Admin
Well-known member
Hi,
have a function in a VB6.0 Project that renames a csv-file to txt file and after that the should be saved as an xls-file.
With installed Excel 2003 and XP the xls-file is created well.
With installed Excel 2010 (uninstalled Excel 2003 on the same hardware) and XP it doesn´t work. No file is created.
So, does anybody know, why the sequence doen´t work?
Would be great!!!
xlApp1.Workbooks.OpenText tmP, 2, 1, 1, 1, False, False, True, False, False, False
xlApp1.DisplayAlerts = False <br/>
xlApp1.Application.Sheets("SetupSup").SaveAs Path + Replace(csvName, "csv", "xls"), 33
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Private Sub CSVtoXLSConverter(ByVal csvName As String)<br/>
Dim xlApp1 As Object<br/>
Dim xlShee As Object
Dim objFso As FileSystemObject<br/>
Dim oTest As Object<br/>
Dim Path, tmP As String
On Error Resume Next
Set objFso = New FileSystemObject <br/>
Set xlApp1 = CreateObject("Excel.Application")<br/>
<br/>
Die *.csv Datei muss voeher in eine *.txt Datei umgewandelt werden<br/>
um anschließend mit dem Code in eine *.xls Datei gewandelt zu werden<br/>
Path = clsVirtualPro.get_XlsFilePath<br/>
objFso.CopyFile Path + csvName, Path + Replace(csvName, "csv", "txt")
tmP = Path + Replace(csvName, "csv", "txt")<br/>
xlApp1.Workbooks.OpenText tmP, 2, 1, 1, 1, False, False, True, False, False, False
xlApp1.DisplayAlerts = False<br/>
<br/>
xlApp1.Application.Sheets("SetupSup").SaveAs Path + Replace(csvName, "csv", "xls"), 33<br/>
xlApp1.Quit<br/>
<br/>
Set xlShee = Nothing<br/>
Set xlApp1 = Nothing<br/>
<br/>
objFso.DeleteFile Path + Replace(csvName, "csv", "txt"), True<br/>
End Sub
View the full article
have a function in a VB6.0 Project that renames a csv-file to txt file and after that the should be saved as an xls-file.
With installed Excel 2003 and XP the xls-file is created well.
With installed Excel 2010 (uninstalled Excel 2003 on the same hardware) and XP it doesn´t work. No file is created.
So, does anybody know, why the sequence doen´t work?
Would be great!!!
xlApp1.Workbooks.OpenText tmP, 2, 1, 1, 1, False, False, True, False, False, False
xlApp1.DisplayAlerts = False <br/>
xlApp1.Application.Sheets("SetupSup").SaveAs Path + Replace(csvName, "csv", "xls"), 33
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Private Sub CSVtoXLSConverter(ByVal csvName As String)<br/>
Dim xlApp1 As Object<br/>
Dim xlShee As Object
Dim objFso As FileSystemObject<br/>
Dim oTest As Object<br/>
Dim Path, tmP As String
On Error Resume Next
Set objFso = New FileSystemObject <br/>
Set xlApp1 = CreateObject("Excel.Application")<br/>
<br/>
Die *.csv Datei muss voeher in eine *.txt Datei umgewandelt werden<br/>
um anschließend mit dem Code in eine *.xls Datei gewandelt zu werden<br/>
Path = clsVirtualPro.get_XlsFilePath<br/>
objFso.CopyFile Path + csvName, Path + Replace(csvName, "csv", "txt")
tmP = Path + Replace(csvName, "csv", "txt")<br/>
xlApp1.Workbooks.OpenText tmP, 2, 1, 1, 1, False, False, True, False, False, False
xlApp1.DisplayAlerts = False<br/>
<br/>
xlApp1.Application.Sheets("SetupSup").SaveAs Path + Replace(csvName, "csv", "xls"), 33<br/>
xlApp1.Quit<br/>
<br/>
Set xlShee = Nothing<br/>
Set xlApp1 = Nothing<br/>
<br/>
objFso.DeleteFile Path + Replace(csvName, "csv", "txt"), True<br/>
End Sub
View the full article