I need help in Excel export to HTML VBA.

Asked By 80 points N/A Posted on -
qa-featured

Hi.  I'm new to this and I need your help.  I have an entire workbook in xls file format that I would like to export to HTML using Visual Basic.  I use Microsoft Excel and Visual Basic 6.  I need help in Excel export to HTML VBA.  Thanks in advance.

SHARE
Answered By 0 points N/A #137729

I need help in Excel export to HTML VBA.

qa-featured

Hi Dorothy

 

 

You can apply the following code for VB to convert the file into HTML VB : 
Imports Spire.Xls

Namespace Xls2Html

 

       Class Program

              Private Shared Sub Main(args As String())

                    'load Excel file

                    Dim workbook As New Workbook()

                    workbook.LoadFromFile("….test.xls")

 

                    'convert Excel to HTML

                    Dim sheet As Worksheet = workbook.Worksheets(0)

                    sheet.SaveToHtml("sample.html")

 

                    'Preview HTML

                    System.Diagnostics.Process.Start("sample.html")

              End Sub

       End Class

End Namespace

 

 

Regards

Bowen Courtemanche

Login/Register to Answer

Related Questions