An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: startIndex can not exceed the string length.
The error only occurs with *.xlsx files and not occurs with *.xls files. This is the code:
Dim Destino As String = "D:\Proyectos\TestSpireXls\Datos_TrimlocV1_ce.html"
Dim Origen As String = "D:\Proyectos\TestSpireXls\Datos_TrimlocV1_ce.xlsx"
Try
If IO.File.Exists(Origen) Then
Dim HojaAExportar As Worksheet
Dim LibroAExportar As New Workbook
LibroAExportar.LoadFromFile(Origen)
HojaAExportar = LibroAExportar.Worksheets(0)
HojaAExportar.SaveToHtml(Destino)
End If
Catch ex As Exception
MessageBox.Show("Error exportando a HTML: " & ex.Message())
End Try