VB and VBA Users Source Code: Importing and Exporting sections of the registry to a .reg file
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Importing and Exporting sections of the registry to a .reg file
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Saturday, July 26, 2003
Hits:
1517
Category:
Files/Directories/IO
Article:
Below are two useful routines to import and export sections of the registry to a ".reg" file. Note, a demonstration routine can be found at the bottom of this article. Option Explicit 'Purpose : Exports a section of the registry to a .reg file 'Inputs : sKey The registry key to export. ' sFilename The file name to export the registry file to. 'Outputs : N/A 'Author : Andrew Baker 'Date : 03/09/2002 'Notes : Uses commandline variables to call Regedit.exe 'Revisions : 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 'Purpose : Imports a windows registry file (.reg) to the registry. 'Inputs : sFilename The path and file name of the file to import. 'Outputs : N/A 'Author : Andrew Baker 'Date : 03/09/2002 'Notes : Uses commandline variables to call Regedit.exe 'Revisions : Sub RegeditImport(sFilename As String) Shell "regedit.exe /s /c " & Chr(34) & sFilename & Chr(34), vbHide End Sub 'Demonstration routine Sub Test() 'Export a section from the VB and VBA program settings to a file RegeditExport "HKEY_CURRENT_USER\Software\VB and VBA Program Settings\VBusersFTP\Connections", "C:\FTP Settings.reg" 'Import this section back in RegeditImport "C:\FTP Settings.reg" End Sub
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder