Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have recently discovered a change when attempting to execute the following Excel 16 VBA Code snippet..

VB
Dim oWShell as Object              'Early binding has no effect on the problem..
 Set oWShell = VBA.CreateObject(WScript.Shell)


Prior to release of a recent MS update that implemented W10 Release 21H1 - Build No 19043.1110, using the Locals window of the VBA Editor, the content of oWShell would show the property CurrentActiveDirectory and the Methods exposed by SET-ing the above object.

The Methods were the primitive functions call-able in VBA Code to manipulate VB Script functions giving access to such things as POPUP ,RUN & EXEC. It also exposed functions to manipulate the registry...

The content of "oWShell" in Locals NOW shows approximately 20 entities comprising the CurrentActiveDirectory property but NO Methods. Where has MS hidden them ?

I need to read and write existing and new Keys to the registry. Any advise on where the methods are now and how I may include and access them from VBA Code gratefully received
Phil.

What I have tried:

Searched the normal Libraries to no avail. Until I can find out where MS have moved 'em I'm stuck. I don't wish to change existing projects to use the restricted VBA.Regxxxx functions as they proscribe the Keys that may be altered and current projects don't match the restricted subset.
Posted
Updated 21-Jul-21 20:52pm
v3
Comments
Maciej Los 22-Jul-21 2:32am    
Sorry, but when you use CreateObject method/function, you use late binding. To use early binding, you'd create an object via Set myObject = New Object

Quote:
I need to read and write existing and new Keys to the registry.


Then... use RegRead[^] and RegWrite[^] methods.

More at: Methods (Windows Script Host) | Microsoft Docs[^]
 
Share this answer
 
Hello, I am having the same problems.
I have created a Microsoft Excel tool that, using VBA Macros, is able to run executables (.exe files). To lauch these .exe files I have been using the following script:
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
Dim errorCode As Long
errorCode = wsh.Run("""" & strProgramName & """ """ & strPositionExcel & """ """ & MyCurrentDir & """ """ & Year & """ """ & CC & """ """ & Category & """ """ & WDDipendenti & """ """ & Availability & """ """ & Projects & """ """ & MTY & """ """ & OM & """ """ & Absent & """", windowStyle, waitOnReturn)


The run method has always worked but after the latest Microsoft update I noticed it isn't working anymore!
Specifically, I get the following Microsoft Visual Basic error:
Run-time error '-2147024894 (80070002)':
method 'Run' of object 'IWshShell3' failed
 
Share this answer
 
Comments
Dave Kreskowiak 5-Aug-21 13:18pm    
Post this as your own question, NOT as an answer to another question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900