• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Run reg file in workbook open

YasserKhalil

Well-Known Member
Hello everyone
I have reg file which I need to run in workbook open ..
Is it possible ? and at the same time to skip the messages Yes and OK
Or it is considered against security levels?
 
It's possible. Something like
Code:
CreateObject("WScript.Shell").Run "%Windowsdirectory%\Regedit.exe /s C:\Yourdirectory\your.reg"

Replace directory with actual ones. Note that if you have space(s) in directory name it needs to be in double quote.

Not sure about prompts.

Edit: This should suppress Yes/No for Regedit. But most likely will have Windows Prompt (User Account Control).
 
Last edited:
Try Import instead of Run?

Edit: I mean something like....
Code:
Dim regimp As Variant

regimp = Shell("reg import C:\yourdirectory\Test.reg")

Oh one more thing. Try below as well.
Code:
Dim xShell As Object
Set xShell = CreateObject("Wscript.Shell")
xShell.Run "%WinDir%\Regedit.exe /s C:\Yourdirectory\your.reg"
 
Last edited:
Back
Top