(Solved) – Workbook Subroutines cannot be called directly by name anymore from VB6

(solved)-–-workbook-subroutines-cannot-be-called-directly-by-name-anymore-from-vb6

I have a vb6 program that calls Macros from an Excel file.

Until recently it worked fine (for years), but now it throws an error.

We get a runtime 438 “Object doesn’t support this property or method” error.

As an example you can use this simple vb6 program:

Set App = CreateObject("Excel.Application")
Set wrkbook = App.Workbooks.Open(fileName)
App.visible = True
wrkbook.Test

The above code doesn’t work anymore.
Instead, if we replace the last line with this:

wrkbook.Application.Run "ThisWorkbook.Test"

it works.
The Excel reference used for this, was “Microsoft Excel 16.0 Object Library”

enter image description here

This has been tested against Excel 2010, 2013, Excel365 with the same results.
Also security settings are all set off in Excel.

Before changing my entire codebase and use Application.Run, I would know why this is happening.

Also using Application.Run has also some downsides, like calling both private & public subs and exceptions thrown are not propagated back to vb6.

Are there other considerations for using Application.Run?

Did Microsoft changed something lately (Scurity update), or am I doing something wrong?

Leave a Reply

Your email address will not be published. Required fields are marked *