Link to home
Start Free TrialLog in
Avatar of Kaprice
KapriceFlag for United States of America

asked on

Run regsvr32 from VBA as Admin with or without a password

My Access deployment uses a 3rd party ActiveX control which requires registering with regsvr32 as Admin.

I found this code which works IF the Admin user has a password:

shell "runas /user:administrator " & zmagic.Strings.WrapInQuotes(strControlDLL, 2), vbNormalFocus

Open in new window


This opens cmd.exe window with a prompt for the admin password but errors out if you just press Enter because there is not Admin password.

On my client machines, I can't guarantee there will or will not be an Admin password so I need code that will allow me to register the DLL whether there is a pw or not.

Ideas?
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Well the basic code to register a dll is:
    c:\regsvr32.exe c:\SomeFolder\sample.ocx

Does this work form the command prompt?

If so, then you can wrap it in code and run it from VBA
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kaprice

ASKER

I wasn't sure how to grade this. It wasn't the answer I was hoping for, meaning the answer doesn't solve my problem, so a B or C seemed appropriate. But, the answer does appear to be accurate, meaning there really is no solution to my question, other than the 3rd party tools mentioned in the answer.

So, I chose "A" (Excellent) since it's not the Expert's fault that VBA or Windows does not provide a way to do what I wanted.

Thanks for your help on this.