Function CreateHTML() As String
Dim ShtNW As Long, xlWbk As Workbook, fs As FileSystemObject, tmpFile As String, c As Long
On Error Goto ErrHdl
With Application
ShtNW = .SheetsInNewWorkbook
If ShtNW > 1 Then .SheetsInNewWorkbook = 1
.ScreenUpdating = False
End With
Range("FundsTable").Copy
Set xlWbk = Workbooks.Add
With Range("A1")
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
End With
Application.CutCopyMode = False
With ThisWorkbook
For c = 1 To ThisWorkbook.Names("FundsTable").RefersToRange.Columns.Count
Columns(c).ColumnWidth = .Names("FundsTable").RefersToRange.Columns(c).ColumnWidth
Next c
End With
xlWbk.SaveAs Format(Now, "mmddyyyyhhmmss") & ".htm", xlHtml
tmpFile = xlWbk.Name
ThisWorkbook.Activate
xlWbk.Close False
Set fs = New FileSystemObject
With fs
With .OpenTextFile(tmpFile, ForReading)
GenrateHTML = .ReadAll
.Close
End With
.DeleteFile tmpFile, True
End With