Skip to main content

Posts

Showing posts with the label Convert xml file to excel using vb.net code

Convert xml file to excel using vb.net code

Private Function XmlToExcelfile(ByVal XMLSourcefileAs String, ByVal ExcelfileAs String)         Dim Exapp As New Excel.Application Dim fileInf As New System.IO.FileInfo(XLSFile) If fileInf.Exists Then SetAttr(XLSXFile, vbNormal) fileInf.Delete() End If Dim fxml As New System.IO.FileInfo(XMLFile) If fxml.Exists Then exapp.Workbooks.Open(XMLFile) exapp.Workbooks.Item(1).CheckCompatibility = True exapp.DisplayAlerts = False exapp.Workbooks.Item(1).SaveAs(XLSXFile,exappcel.XlFileFormat.xlWorkbookDefault) exapp.DisplayAlerts = False exapp.Workbooks.Close() SetAttr(XMLFile, vbNormal) fxml.Delete() Else MessageBox.Show("XML File does not exists") End If Dim file2 As New System.IO.FileInfo(XLSXFile) If file2.Exists Then SetAttr(XLSFile, FileAttribute.Normal) End If exapp.Quit() Exapp= Nothin