VB6 Call Word/Excel 2013 error is not a valid Win32 application

Viewed 144

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.

0 Answers
Related