自2007年升级到2013年以来,OpenText运行时错误1004无法访问文件 [英] OpenText Run-time Error 1004 Cannot Access the File Since Upgrade from 2007 to 2013

查看:115
本文介绍了自2007年升级到2013年以来,OpenText运行时错误1004无法访问文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的团队有一个将启用宏的Excel文件放在安全Web服务器上的文件夹中的过程。当用户从网页单击该Excel文件并选择"打开"时,用户会收到Windows安全消息。然后,用户输入访问安全Web服务器所需的用户名和密码
,Excel宏开始启动。它从同一个安全的Web服务器导入并处理一堆文本文件(超过100个),并生成一个多标签报告。在我们从2007年更新到2013年之后,流程仍然是
导入并处理多个文本文件,但它大约停止一半并返回错误1004:无法访问文件。





如果我通过FTP将所有文件下载到文件夹,则保存并运行该文件夹中的启用宏的Excel文件,工作良好。当尝试按照预期从该安全Web服务器运行它时,它只会出现1004错误。我想知道Excel是否以某种方式
忘记了向https服务器发出x个请求后的登录信息。任何想法如何验证这个并停止它,如果这是正在发生的事情,以便Excel报告完成?



运行此代码块时会发生错误:


openname = trim(base_data_dir)& " /" &安培; trim(cfilefull)

    On Error GoTo handler_c5

    Workbooks.OpenText文件名:= openname _

          ,原产地:= xlWindows _

          ,StartRow:= 1 _

          ,DataType:= xlDelimited _

          ,TextQualifier:= xlDoubleQuote _

          ,ConsecutiveDelimiter:= False _

          ,Tab:=真_

          ,分号:=假,逗号:=假,空格:=假_

          ,其他:= True,OtherChar:=" |" _

          ,FieldInfo:=数组(数组(1,1),数组(2,1),数组(3,1),数组(4,1),数组(5,1)_

  ;             ,Array(6,1),Array(7,1),Array(8,1),Array (9,1),数组(10,1)_

              ,数组(11,1),数组(12,1),数组(13,1),数组(14,1),数组(15,1)_

      ;          ,Array(16,1),Array(17,1),Array(18,1),Array(19,1),数组(20,1)_

              ,Array(21,1) ,Array(22,1),Array(23,1),Array(24,1),Array(25,1),Array(26,1))

    On Error GoTo 0




谢谢!

解决方案

>>>如果我通过FTP将所有文件下载到文件夹,然后保存并运行该文件夹中的启用宏的Excel文件,它可以正常工作。当尝试按照预期从该安全Web服务器运行时,它只会出现1004错误。



根据您的描述,开发人员可以使用Microsoft Office中的自动化构建使用Office产品中内置功能和功能的自定义解决方案。虽然这种程序化开发可以相对容易地在客户端
系统上实现,但如果从服务器端代码(如Microsoft Active Server Pages(ASP),ASP.NET,DCOM)进行自动化,则会出现许多复杂情况。或者Windows NT服务。



Microsoft强烈建议开发人员在需要开发服务器端解决方案时找到Office自动化的替代方案。由于Office设计的限制,对Office配置的更改不足以解决所有问题。 Microsoft
强烈建议使用许多替代方案,这些方案不需要在服务器端安装Office,并且可以比自动化更高效,更快速地执行大多数常见任务。在将Office作为项目中的服务器端组件介入之前,
考虑替代方案。



大多数服务器端自动化任务涉及文档创建或编辑。 Office 2007支持新的Open XML文件格式,允许开发人员在服务器端创建,编辑,读取和转换文件内容。这些文件格式使用Microsoft .NET 3.x Framework中的System.IO.Package.IO命名空间
来编辑Office文件,而无需使用Office客户端应用程序本身。这是处理来自服务的Office文件更改的推荐和支持方法。



有关详细信息,请参阅
服务器端Office自动化的注意事项




感谢您的理解

My team has a process that places a macro-enabled Excel file in a folder on a secure web server. When a user clicks on that Excel file from the web page and selects Open, the user receives a Windows Security message. The user then enters a username and password required to access the secure web server, and the Excel macro starts kicking off. It imports and processes a bunch of text files (over 100) from the same secure web server and produces a multi-tab report. After we updated from 2007 to 2013, the process still imports and processes several text files, but it stops approximately halfway through and returns an Error 1004: Cannot Access the File.

If I download all of the files via FTP to a folder then Save and Run the macro-enabled Excel file from that folder, it works fine. It only blows up with the 1004 error when trying to run it from that secure web server as intended. I wonder if Excel somehow forgets the logon information after x number of requests out to the https server. Any ideas how to verify this and stop it if this is what's happening so that the Excel report completes?

It is running this block of code where the error occurs:

openname = trim(base_data_dir) & "/" & trim(cfilefull)
    On Error GoTo handler_c5
    Workbooks.OpenText Filename:=openname _
          , Origin:=xlWindows _
          , StartRow:=1 _
          , DataType:=xlDelimited _
          , TextQualifier:=xlDoubleQuote _
          , ConsecutiveDelimiter:=False _
          , Tab:=True _
          , Semicolon:=False, Comma:=False, Space:=False _
          , Other:=True, OtherChar:="|" _
          , FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1) _
                           , Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1) _
                           , Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15, 1) _
                           , Array(16, 1), Array(17, 1), Array(18, 1), Array(19, 1), Array(20, 1) _
                           , Array(21, 1), Array(22, 1), Array(23, 1), Array(24, 1), Array(25, 1), Array(26, 1))
    On Error GoTo 0

Thanks!

解决方案

>>>If I download all of the files via FTP to a folder then Save and Run the macro-enabled Excel file from that folder, it works fine. It only blows up with the 1004 error when trying to run it from that secure web server as intended.

According to your description, developers can use Automation in Microsoft Office to build custom solutions that use the capabilities and the features that are built into the Office product. Although such programmatic development can be implemented on a client system with relative ease, a number of complications can occur if Automation takes place from server-side code such as Microsoft Active Server Pages (ASP), ASP.NET, DCOM, or a Windows NT service.

Microsoft strongly recommends that developers find alternatives to Automation of Office if they need to develop server-side solutions. Because of the limitations to Office's design, changes to Office configuration are not enough to resolve all issues. Microsoft strongly recommends a number of alternatives that do not require Office to be installed server-side, and that can perform most common tasks more efficiently and more quickly than Automation. Before you involve Office as a server-side component in your project, consider alternatives.

Most server-side Automation tasks involve document creation or editing. Office 2007 supports new Open XML file formats that let developers create, edit, read, and transform file content on the server side. These file formats use the System.IO.Package.IO namespace in the Microsoft .NET 3.x Framework to edit Office files without using the Office client applications themselves. This is the recommended and supported method for handling changes to Office files from a service.

For more information, please refer to Considerations for server-side Automation of Office

Thanks for your understanding.


这篇关于自2007年升级到2013年以来,OpenText运行时错误1004无法访问文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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