保存Excel文件时,Windows 10 COMException HRESULT:0X800A03EC

时间:2017-06-30 09:39:42

标签: vb.net excel-interop hresult

我有一个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

1 个答案:

答案 0 :(得分:0)

我已经发现问题出在<10>在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

找到了解决方案
相关问题