32-bit excel VBE referred 64-bit MS scripting runtime

Anonymous
2022-09-06T03:04:48+00:00

Problem: I developed a VBA script which refers MS scripting runtime but met with following error.

Actions have taken:

  1. Register "C:\Windows\System32\scrrun.dll", successful
  2. Run system file check (sfc.exe), no error was reported on scrrun.dll
  3. Repair office online. After repair this error still exist

When I checked Excel and MS scripting runtime version, seems they do not match each other.

Excel is 32-bit

MS scripting runtime is 64-bit

Can anyone give suggestions?

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-09-06T03:53:06+00:00

    Re: "Can anyone give suggestions?"

    If you made the reference to the MS scripting runtime then your declarations would look like this...

    Dim objFSO     As Scripting.FileSystemObject
    Dim objFolder  As Scripting.Folder
    Dim objFile    As Scripting.File

    [EDIT-added]

    Set objFSO = New Scripting.FileSystemObject
    Set objFolder = objFSO.GetFolder(strPath)

    You don't need to use CreateObject.

    '---

    Nothing Left to Lose

    https://1drv.ms/u/s!Au8Lyt79SOuhZw2MCH7_7MuLj04?e=sAwbHU

    (free excel programs)

    0 comments No comments
  2. Anonymous
    2022-09-06T04:16:35+00:00

    Hi,

    Thank you for your fast response. I would prefer to use late binding rather than early binding.

    Because if I distribute this spreadsheet to anyone else, she/he doesn't need to do any extra setting in VBE/tools/references

    0 comments No comments