Private Sub konverze(sender As Object, e As EventArgs) Dim msExcelApplication As New Microsoft.Office.Interop.Excel.Application() Dim workBook As Microsoft.Office.Interop.Excel.Workbook = msExcelApplication.Workbooks.Open("C:\Users\cahafi\Documents\vbexcel.xlsx", 0, False, Type.Missing, "", "", True, Type.Missing, Type.Missing, True, False, Type.Missing, True, False, False) Try Dim workSheet As Microsoft.Office.Interop.Excel.Worksheet = workBook.Sheets(1) With workSheet.QueryTables.Add(Connection:="TEXT;C:\Users\cahafi\Documents\vbexcel.csv", Destination:=workSheet.Range("$A$1")) .Name = "vbexcel" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .SavePassword = False .RefreshStyle = Microsoft.Office.Interop.Excel.XlCellInsertionMode.xlInsertDeleteCells .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 1250 .TextFileStartRow = 1 .TextFileParseType = Microsoft.Office.Interop.Excel.XlTextParsingType.xlDelimited .TextFileTextQualifier = Microsoft.Office.Interop.Excel.XlTextQualifier.xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = False .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = False .TextFileTrailingMinusNumbers = True .Refresh(BackgroundQuery:=False) End With Catch ex As Exception Console.WriteLine(ex.ToString()) Console.ReadLine() Finally workBook.Close(True) End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)