ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Export registry keys? (https://www.excelbanter.com/excel-programming/449527-export-registry-keys.html)

Charlotte E.[_3_]

Export registry keys?
 
Hi,


Is it possible (and, if so, how?) to export a certain key, and all its
values and (if any) subkeys/values, to an .REG-file?

(Just as if you would export from the Registry itself manually)


Thanks in advance,

CE



GS[_2_]

Export registry keys?
 
Hi Charlotte,

Have a look here to see if this has what you need...

http://www.freevbcode.com/ShowCode.asp?ID=2598

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


GS[_2_]

Export registry keys?
 
I also did some further looking and found the following code samples. I
tested them and it worked just fine 'as is'!

Sub RegeditExport(sKey As String, sFilename As String)
Shell "regedit.exe /s /e " & Chr(34) & sFilename & Chr(34) & " " &
Chr(34) & sKey & Chr(34), vbHide
End Sub

Sub RegeditImport(sFilename As String)
Shell "regedit.exe /s /c " & Chr(34) & sFilename & Chr(34), vbHide
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


Charlotte E.[_3_]

Export registry keys?
 
Stupid, stupid, stupid me!

Of cause - should have thought of that - using Shell and the RegEdit isself
as a shortcut :-)

Thanks, Garry .-)



"GS" wrote in message ...
I also did some further looking and found the following code samples. I
tested them and it worked just fine 'as is'!

Sub RegeditExport(sKey As String, sFilename As String)
Shell "regedit.exe /s /e " & Chr(34) & sFilename & Chr(34) & " " &
Chr(34) & sKey & Chr(34), vbHide
End Sub

Sub RegeditImport(sFilename As String)
Shell "regedit.exe /s /c " & Chr(34) & sFilename & Chr(34), vbHide
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



---
This email is free from viruses and malware because avast! Antivirus
protection is active.
http://www.avast.com




GS[_2_]

Export registry keys?
 
Stupid, stupid, stupid me!

Of cause - should have thought of that - using Shell and the RegEdit
isself as a shortcut :-)

Thanks, Garry .-)


Not stupid at all! I originally thought you'd need to enum subkeys
recursively and build a file string of keys, subkeys, and values as you
go. But then I thought there has to be a simpler way, and so I googled.

I wasn't aware of the command line switches regedit.exe exposes and so
was quite pleased to find the sample. It's really 'clean', IMO. I don't
use the Registry at all for my apps because I've configured them to be
fully portable so they can run from a memstick. Thus, I use ini/dat
files to store settings and other data. I do have (and did use
extensively) a similar wrapper (mRegistryAPI.bas) as what I posted the
link for, but I seldom use it anymore.<g I have updated it, though, to
include these export/import procedures...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com



All times are GMT +1. The time now is 10:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com