【问题标题】:Windows 10 COMException HRESULT:0X800A03EC while saving Excel file保存 Excel 文件时 Windows 10 COMException HRESULT:0X800A03EC
【发布时间】:2017-07-04 17:29:33
【问题描述】:

我有一个 VB.Net windows 窗体应用程序,它在 windows 7 环境中运行良好。

现在,我想升级到 Windows 10。所以我开始在 Windows 10 服务器机器上测试我的应用程序。

我收到Exception(HRESULT 异常:0X800A03EC),同时将动态生成的文件保存在服务器上的一个文件夹中。

我已确定问题不在于权限。

'getting exception at this line of code.
xlApp.Workbooks(1).SaveAs(filename , xl.XlFileFormat.xlHtml)

参考代码:

Private Sub VierwInBrowser(ByVal xlApp As xl.Application)
    Dim fileName As String = String.Format("{0}\{1}", "C:\Data", GetUniqueFileName())
Try
    xlApp.Workbooks(1).SaveAs(fileName, xl.XlFileFormat.xlHtml)
Catch ex as Exception
Messagebox.Show(ex.Message)
End Try
    xlApp.Quit()
    xlApp = Nothing
    GC.Collect()
    browser.Visible = True
    browser.Navigate(fileName)
    browser.BringToFront()
End Sub

【问题讨论】:

  • 您好,欢迎来到 SO,您能否发布导致异常的代码块?这将帮助我们帮助您...
  • 嗨马丁,谢谢您的回复...我在这行代码 xlApp.Workbooks(1).SaveAs(filename , xl.XlFileFormat.xlHtml) //geting这一行的例外。请查看我在帖子中分享的链接
  • 是的,我看到了这张照片。我提到了导致此异常的代码块。
  • 请检查以下解决方案:stackoverflow.com/a/7108420/5897829
  • 我已经完成了上述解决方案。但仍然遇到同样的异常。

标签: vb.net excel-interop hresult


【解决方案1】:

我发现问题出在 Windows 10 中将 excel 工作表转换为 html 页面

为此,我在https://support.microsoft.com/en-in/help/922850/error-message-in-office-when-a-file-is-blocked-by-registry-policy-sett找到了解决方案

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-13
    • 1970-01-01
    • 1970-01-01
    • 2023-03-12
    • 2018-06-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多