Hi: This program only write in excel the second sheet and nothing in the first sheet, i dont know why, thanks for your help, the program reads to text files
Dim xl As Object
xl = CreateObject("Excel.Application")
xl.Visible = True
xl.Workbooks.Add()
xl.Sheets("Sheet" & 1).Select()
xl.Workbooks.OpenText(Filename:="C:\Documents and Settings\User\Desktop\429\sheet1" & ".txt", Origin:=Excel.XlPlatform.xlMSDOS, StartRow:=1, _
DataType:=Excel.XlTextParsingType.xlFixedWidth, TextQualifier:=Excel.XlTextQualifier.xlTextQualifierNone, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, Comma:=False, Space:=False, Other:=False, _
FieldInfo:=New Object() {New Object() {0, 2}, New Object() {9, 9}, _
New Object() {11, 1}, New Object() {12, 9}, New Object() {14, 1}, New Object() {46, 1}, _
New Object() {56, 9}, New Object() {58, 5}, New Object() {64, 9}, New Object() {66, 1}, _
New Object() {74, 9}, New Object() {76, 1}, New Object() {82, 9}, New Object() {84, 1}, _
New Object() {89, 9}, New Object() {91, 5}, New Object() {97, 9}, New Object() {99, 5}, _
New Object() {105, 9}, New Object() {107, 5}, New Object() {113, 9}, New Object() {115, 1}, _
New Object() {116, 9}})
xl.Sheets("Sheet" & 1).name = "cesar"
xl.Workbooks.Add()
xl.Sheets("Sheet" & 2).Select()
xl.Workbooks.OpenText(Filename:="C:\Documents and Settings\User\Desktop\429\sheet2" & ".txt", Origin:=Excel.XlPlatform.xlMSDOS, StartRow:=1, _
DataType:=Excel.XlTextParsingType.xlFixedWidth, TextQualifier:=Excel.XlTextQualifier.xlTextQualifierNone, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, Comma:=False, Space:=False, Other:=False, _
FieldInfo:=New Object() {New Object() {0, 2}, New Object() {9, 9}, _
New Object() {11, 1}, New Object() {12, 9}, New Object() {14, 1}, New Object() {46, 1}, _
New Object() {56, 9}, New Object() {58, 5}, New Object() {64, 9}, New Object() {66, 1}, _
New Object() {74, 9}, New Object() {76, 1}, New Object() {82, 9}, New Object() {84, 1}, _
New Object() {89, 9}, New Object() {91, 5}, New Object() {97, 9}, New Object() {99, 5}, _
New Object() {105, 9}, New Object() {107, 5}, New Object() {113, 9}, New Object() {115, 1}, _
New Object() {116, 9}})
xl.Sheets("Sheet" & 2).name = "martinez"
xl.Worksheets(1).SaveAs("C:\Documents and Settings\User\Desktop\filetemp\bo" & ".xls", Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange)
xl.Quit()
xl = Nothing
Dim xl As Object
xl = CreateObject("Excel.Application")
xl.Visible = True
xl.Workbooks.Add()
xl.Sheets("Sheet" & 1).Select()
xl.Workbooks.OpenText(Filename:="C:\Documents and Settings\User\Desktop\429\sheet1" & ".txt", Origin:=Excel.XlPlatform.xlMSDOS, StartRow:=1, _
DataType:=Excel.XlTextParsingType.xlFixedWidth, TextQualifier:=Excel.XlTextQualifier.xlTextQualifierNone, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, Comma:=False, Space:=False, Other:=False, _
FieldInfo:=New Object() {New Object() {0, 2}, New Object() {9, 9}, _
New Object() {11, 1}, New Object() {12, 9}, New Object() {14, 1}, New Object() {46, 1}, _
New Object() {56, 9}, New Object() {58, 5}, New Object() {64, 9}, New Object() {66, 1}, _
New Object() {74, 9}, New Object() {76, 1}, New Object() {82, 9}, New Object() {84, 1}, _
New Object() {89, 9}, New Object() {91, 5}, New Object() {97, 9}, New Object() {99, 5}, _
New Object() {105, 9}, New Object() {107, 5}, New Object() {113, 9}, New Object() {115, 1}, _
New Object() {116, 9}})
xl.Sheets("Sheet" & 1).name = "cesar"
xl.Workbooks.Add()
xl.Sheets("Sheet" & 2).Select()
xl.Workbooks.OpenText(Filename:="C:\Documents and Settings\User\Desktop\429\sheet2" & ".txt", Origin:=Excel.XlPlatform.xlMSDOS, StartRow:=1, _
DataType:=Excel.XlTextParsingType.xlFixedWidth, TextQualifier:=Excel.XlTextQualifier.xlTextQualifierNone, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, Comma:=False, Space:=False, Other:=False, _
FieldInfo:=New Object() {New Object() {0, 2}, New Object() {9, 9}, _
New Object() {11, 1}, New Object() {12, 9}, New Object() {14, 1}, New Object() {46, 1}, _
New Object() {56, 9}, New Object() {58, 5}, New Object() {64, 9}, New Object() {66, 1}, _
New Object() {74, 9}, New Object() {76, 1}, New Object() {82, 9}, New Object() {84, 1}, _
New Object() {89, 9}, New Object() {91, 5}, New Object() {97, 9}, New Object() {99, 5}, _
New Object() {105, 9}, New Object() {107, 5}, New Object() {113, 9}, New Object() {115, 1}, _
New Object() {116, 9}})
xl.Sheets("Sheet" & 2).name = "martinez"
xl.Worksheets(1).SaveAs("C:\Documents and Settings\User\Desktop\filetemp\bo" & ".xls", Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange)
xl.Quit()
xl = Nothing