gpt4 book ai didi

html - 如何将报告导出到一个 html 文件?

转载 作者:太空狗 更新时间:2023-10-29 15:02:22 25 4
gpt4 key购买 nike

当我使用 Report 的 Export to html 功能时,Access 会生成多页 html(每页大约有 30 行左右的数据)。

如何强制 Access 为整个报告生成一个 html 文件?谢谢。

最佳答案

我创建了一个可能对其他人有帮助的功能。它采用文件路径,然后跟随链接直到文档完成。您需要将报告导出到 html 文件,然后在此函数中使用该路径。我用它来为 Outlook 创建消息。这需要引用 Windows 脚本宿主对象模型

Public Function fReadFile(strFile As String) As String
On Error GoTo ErrHandler

Dim FSO As FileSystemObject
Dim tsInput As TextStream
Dim strLine, strMessage As String
Dim strNextFile As String
Dim blnEnd As Boolean

Do While Not blnEnd
Set FSO = New FileSystemObject
Set tsInput = FSO.OpenTextFile(strFile, 1)
Do While Not tsInput.AtEndOfStream
strLine = tsInput.ReadLine
If InStr(1, strLine, ">First<", vbTextCompare) > 0 And InStr(1, strLine, ">Previous<", vbTextCompare) > 0 And InStr(1, strLine, ">Next<", vbTextCompare) > 0 And InStr(1, strLine, ">Last<", vbTextCompare) > 0 Then
Debug.Print strLine
strNextFile = Mid(strLine, InStr(1, strLine, ">Previous</A> <A HREF=", vbTextCompare) + 23, InStr(1, strLine, """>Next<", vbTextCompare) - (InStr(1, strLine, ">Previous</A> <A HREF=", vbTextCompare) + 23))
rem put the directory back in the file name
strNextFile = IIf(strNextFile <> "#", Mid(strFile, 1, (InStrRev(strFile, "\"))) & strNextFile, strFile)
blnEnd = (strNextFile = strFile)
Else
strMessage = strMessage & strLine
End If
Loop
tsInput.Close
Set FSO = Nothing
strFile = strNextFile
Loop
fReadFile = strMessage
Exit Function
ErrHandler:
Debug.Print Err.Description & " " & "fReadFile"
Resume Next
End Function

关于html - 如何将报告导出到一个 html 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6797709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com