3
votes

I have a VBA project which uses two workbooks on the same time. In workbook A, a module calls a module from workbook B like this:

If oED Is Nothing Then 
      Set oED = Application.Run("'" & workbookB & "'!wbB.MainModule.InitDatabaseObject")
End If

This has previously worked fine, but suddenly (apparently) this line of code doesn't find the module/macro in the other workbook.

I get this error message

Error 1004. The macro may not be available in this workbook or all macros may be disabled.

I have tried to:

  • Clear the macro settings in Excel
  • Clean the workbook (using a tool)
  • Delete ActiveX cache files (*.exd files)

When my work colleague runs the same workbooks on his computer, this works fine.

Does anyone have a clue what's going on?

Br, Johan

1
Perhaps the path is wrong for your computer?Rory
Make sure wbB and MainModule weren't renamed.Vincent G
@Rory The paths shouldn't be relevant as they are in same folderJohan A
@Vincent G But they are still the same on my colleagues computer as he ran the exact same workbooksJohan A
Is the other workbook open at the time, and what is your Application.AutomationSecurity set to?Rory

1 Answers

1
votes

Found the culprit. The workbookB simply didn't compile. After correcting it and making sure it compiled the Application.Run worked fine.