VB6 调用 Word/Excel 2013 错误不是有效的 Win32 应用程序

发布于 2025-01-09 07:55:46 字数 1487 浏览 0 评论 0原文

我有一个VB6中的旧exe代码,这个exe将调用Microsoft Word或Excel将一些处理后的数据导出为Word或Excel格式。

该程序曾经在电脑上运行良好,没有任何问题,直到最近突然无法连接到同一台电脑上的Word或Excel。

连接Word的vb6程序是这样的:

Dim objWord As Object

' The following line will cause is not a valid Win32 application error.
Set objWord = CreateObject("Word.Application")

错误信息看起来像是无法调用Word,因为它不是Win32 exe。

这是我发现的:

  • Word/Excel 可以打开并运行,没有任何问题。这意味着 Word 或 Excel 文件没问题。
  • Word/Excel 安装在C:\Program Files 中。这是否意味着它是 64 位版本?由于这是 64 位 Windows,因此 32 位应用程序应安装在 C:\Program Files (x86) 文件夹中。
  • Word/Excel 关于我显示它是 32 位版本。

我尝试使用 dumpbin 检查 winword.exe:

FILE HEADER VALUES
         14C machine (x86)
           5 number of sections
    61726647 time date stamp Fri Oct 22 15:20:39 2021
           0 file pointer to symbol table
           0 number of symbols
          E0 size of optional header
         102 characteristics
               Executable
               32 bit word machine

从 Windows 中,我发现 Microsoft Office 安装日期是 21/02/2022。但用户表示他们确实对电脑办公室做了任何事情。 Office 更新会导致日期更改吗?

我的问题是:

  1. 这个错误是由word/excel是64位版本引起的吗?
  2. 据我所知,word/excel是32位版本还是64位版本?

2022-02-25更新

我已经编写了早期绑定的测试代码:

Dim objWord As Word.Application

' The following line will cause is not a valid Win32 application error.
Set objWord = new Word.Application

但仍然出现同样的错误。

I've an old exe code in VB6, this is exe will call Microsoft Word or Excel to export some processed data into Word or Excel format.

The program had working fine without any issue in a pc for sometime, until recently it suddenly cannot connect to Word or Excel on the same pc.

The vb6 program to connect to Word is like this:

Dim objWord As Object

' The following line will cause is not a valid Win32 application error.
Set objWord = CreateObject("Word.Application")

The error message looks like it cannot call the Word because it's not Win32 exe.

Here is what I found:

  • The Word/Excel can open and run without any issue. So mean the Word or Excel file is ok.
  • The Word/Excel is installed in C:\Program Files. Is this mean it's 64 bit version? Because this is a 64 bit Windows, so 32 bit application should install in C:\Program Files (x86) folder.
  • Word/Excel About Me show that it's 32 bit version.

I've try check the winword.exe with dumpbin:

FILE HEADER VALUES
         14C machine (x86)
           5 number of sections
    61726647 time date stamp Fri Oct 22 15:20:39 2021
           0 file pointer to symbol table
           0 number of symbols
          E0 size of optional header
         102 characteristics
               Executable
               32 bit word machine

From Windows, I found that Microsoft Office install date is 21/02/2022. But user said they did do anything to the pc office. Will Office Update cause the date change?

My question is:

  1. Is this error cause by the word/excel is 64 bit version?
  2. From what I found, the word/excel is 32 bit or 64 bit version?

Update on 2022-02-25

I've write a testing code with early binding:

Dim objWord As Word.Application

' The following line will cause is not a valid Win32 application error.
Set objWord = new Word.Application

But the same error still occurred.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文