Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding/changing registry keys Michelle Excel Programming 1 May 10th 10 05:35 PM
Registry Keys EA Excel Programming 1 June 1st 06 10:07 PM
Read Registry Keys (and possibly write) Mike Iacovou Excel Programming 4 April 8th 06 05:05 PM
How to use Alt keys + symbol keys to invoke a macro? keithb Excel Programming 1 December 19th 05 08:54 PM
Retrieving Registry keys Kent Schederin Excel Programming 5 September 3rd 04 04:18 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"