当模板目录位于网络驱动器上时,Word 2010自动化文档打开失败。 [英] Word 2010 automation document open fails when template directories are on a network drive.

查看:84
本文介绍了当模板目录位于网络驱动器上时,Word 2010自动化文档打开失败。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

· < span style ="font:7pt" Times New Roman"">        
我们有第三方应用程序,因为我们升级到Office 2010后无效。我已经确定当用户的工作组模板目录或用户模板目录打开时,通过自动化打开文档
时的问题网络驱动器。我写了一个VB测试应用程序来重现问题......

Private Sub btnTryCatch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTryCatch.Click
  Dim app As New Word.Application

  Try
    Dim doc As Word.Document
    doc = app.Documents.Open("c:\test\test1.docx")
    Debug.WriteLine("no chars in doc: " & doc.Characters.Count.ToString)
    doc.Close(False)
    NAR(doc)
    GC.Collect()
    GC.WaitForPendingFinalizers()
  Catch ex As Exception
    Debug.WriteLine(ex.ToString)
  Finally
    Debug.WriteLine("Finished")
    app.Quit()
    NAR(app)
    GC.Collect()
    GC.WaitForPendingFinalizers()
  End Try
End Sub
Private Sub NAR(ByVal o As Object)
  Try
    System.Runtime.InteropServices.Marshal.ReleaseComObject(o)
  Catch
  Finally
    o = Nothing
  End Try
End Sub


使用基于网络的模板目录,我得到一个System.Runtime.InteropServices.COMException(0x800A1066):命令失败(随机,有时可行)

使用本地模板目录,每次都可以使用。

(Word选项 - 高级 - 文件位置 - 用户模板/工作组模板)

有什么想法吗?

非常感谢。

John。

推荐答案

我有一个相关的(如果不是相同的)问题:

I have a related (if not the same) issue:

将宏安全性设置为"禁用通知",Word 2010用户无法为他们根据DOT或DOTM文件创建的DOCX文档启用宏安全性,也无法为基于DOTM文件的DOC文件启用宏安全。如果他们从DOT模板创建DOC文档,那么
将会提示他们并启用宏。

With Macro Security set to "Disable with Notification," Word 2010 users cannot enable macro security for DOCX documents they've created based on DOT nor DOTM files, nor DOC files based on DOTM files. If they create a DOC document from a DOT template, then they will be prompted and can enable macros.

Word 2007没有这个问题;即使基本模板在服务器上,它也允许用户启用宏,无论是DOT还是DOTM,DOC或DOCX 。

Word 2007 doesn't have this problem; it lets users enable macros even if the base template is on the server, and whether or not it is DOT or DOTM, DOC or DOCX.

对于在工作组模板路径中保留启用宏的模板的用户来说,这是一个重大问题。

This is a significant problem for users that keep macro-enabled templates in the Workgroup Templates path.

何时修复?


这篇关于当模板目录位于网络驱动器上时,Word 2010自动化文档打开失败。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆