Reputation: 2193
As I mentioned in the Q-title, I have a VBScript which I am sure was working fine in Windows 10 with Microsoft® Excel® LTSC MSO (Version 2205 Build 16.0.15225.20278) 64-bit
Excel version and once I made sure that ClickToRunSvc
service was running, and then when I ran this VBScript(without any elevation) it did open any Excel secured sheet with password, so that I didn't have to enter password everytime I wanted to open the sheet(I know not very secure, but this is my system behind firewall, so not much worried about it there).:
Sub OpenChosenLockedSheet(ChosenFile)
AdminElevate
Set objExcel = CreateObject("Excel.Application")
objExcel.SendKeys "% x" : objExcel.Visible = True : objExcel.SendKeys "% x"
CreateObject("Wscript.Shell").AppActivate GetObject(, "Excel.Application").Caption
Set objWorkbook = objExcel.Workbooks.Open(ChosenFile, , , ,"<password>")
Set objExcel = Nothing : Set objWorkbook = Nothing
End Sub
But now after fully upgrading the OS to Windows 11, this same above script, running with same Office Excel version, doesn't open the Excel.Application
at all and throws the below(also very infamous) error, unless I self-elevate the above script(that's why AdminElevate
is uncommented) and open the secured sheet:
Error: ActiveX component can't create object: 'Excel.Application'
Code: 800A01AD
So my query: Is this part of bigger change Microsoft made when it rolled out Windows 11 and I missed or there needs to be some extra coding or quick-fix done to make this script work without admin-elevation ? Anyone feel free to help out.
Upvotes: 0
Views: 584