如何使用vba获取html格式的excel数据?

Access中的数据库来自ODBC数据库。 我需要的数据是在备忘录字段中有大约10,000个字符。 我通常使用HTML格式复制粘贴到Excel中。

ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _ False, NoHTMLFormatting:=True 

但是,我想自动化这个过程,我试图把它合并到下面的代码。 PasteSpecial在build立连接后不起作用。

 Private Sub RetrieveRecordset(strSQL As String, clTrgt As Range) 'Author : Ken Puls (www.excelguru.ca) 'Macro Purpose: To retrieve a recordset from a database (via an SQL query) and place ' it in the supplied worksheet range 'NOTE : Requires a reference to "Microsoft ActiveX Data Objects 2.x Library" ' (Developed with reference to version 2.0 of the above) Dim cnt1 As New ADODB.Connection Dim rst1 As New ADODB.Recordset Dim rcArray As Variant Dim lFields As Long Dim lRecrds As Long Dim lCol As Long Dim lRow As Long 'Open connection to the database cnt1.Open glob_sConnect 'Open recordset based on Orders table rst1.Open strSQL, cnt1 'Count the number of fields to place in the worksheet lFields = rst1.Fields.Count 'Copy the recordset from the database On Error Resume Next clTrgt.CopyFromRecordset rst1 'CopyFromRecordset will fail if the recordset contains an OLE 'object field or array data such as hierarchical recordsets If Err.Number <> 0 Then GoTo EarlyExit EarlyExit: 'Close and release the ADO objects rst1.Close cnt1.Close Set rst1 = Nothing Set cnt1 = Nothing On Error GoTo 0 End Sub Sub GetRecords() 'Find the newest record which contains data which has previously been used for each database 'Generate the SQL queries sFCESQLQry = " SELECT...." 'Paste in Workbook wbFurnace.Activate Set rngTarget = ActiveSheet.Range("A2") Range("A1").PasteSpecial **Format:="HTML", Link:=False, DisplayAsIcon:= _ False, NoHTMLFormatting:=True** Call RetrieveRecordset(sFCESQLQry, rngTarget) End Sub 

PasteSpecial在这种情况下不起作用。 它确实工作,如果我使用x1Pasteall,但数据是表格,而不是我想要的HTML格式。 关于这个问题的任何想法? 让我知道是否有替代方法来获取数据的HTML格式。