Convert Excel to HTML VB.Net



  • Start Visual Studio.
  • On the File menu, point to New, and then click Project.
  • In the templates pane, expand Visual C# or Visual Basic, and then expand Office.
  • Under the expanded Office node, select the 2007 if you have Excel 2007 installed, or select the 2010 node if you have Excel 2010 installed.
  • In the list of project templates, select Excel 2007 Add-in or Excel 2010 Add-in.
  • In the Name box, type Excel2HtmlConverter.
  • Click OK.

    Now write following code


    Public Class ThisAddIn


        Private Sub ThisAddIn_Startup() Handles Me.Startup
            Application.Workbooks.Open("c:/vin.xlsx")
        End Sub


        Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
            Application.ActiveWorkbook.SaveAs("c:/vin.htm", Excel.XlFileFormat.xlHtml)
        End Sub


    End Class

    This will convert .xlsx file to html file. Choose path appropriately.

    By:
    - Vinod Kotiya
  • Comments