[RESOLVED] Naming .REG file Help Please
Hi All! :wave: I'm new to programing and VB ( Well, did do a bit of batch file work back in the bad ol' day of DOS!). :eek:
Anyway, I need some help with the following.
I'm working on a program to export a registry key and save the .REG file. Right now it saves the file to a specific path and file name. The part I need help with is having the user name the file. It would still be saved to the specific path. I was thinking about calling a form with a text box where the user would input the filename (except the ".REG" which would be hard coded.) and click on a button to save the file.
(BTW- This will be running from a thumb drive. Thus the relative path.)
Right now the code I'm using is this (short & simple!):
VB Code:
'Registry Key Backup - This Works.
Private Sub cmdBackup_Click()
'This will export the registery info from (HKEY_LOCAL_MACHINE\Software\MyApp\IIP\Option)
'to the app.path
Shell "regedit /e ./Backups/OptionKeys.reg HKEY_LOCAL_MACHINE\Software\MyApp\IIP\Option"
Call MsgBox("The Option Key backup has been saved. ", vbOKOnly + vbInformation + vbApplicationModal + vbDefaultButton1, "FILE SAVE")
End Sub
Thanks for any help & suggestions!
Re: Naming .REG file Help Please
I write a relative path like you, maybe you have to change it in order to make it work.
VB Code:
Name "..\Backups\OptionKeys.reg" as "..\Backups\" & user_specified_filename & ".reg"
Re: Naming .REG file Help Please
Quote:
Originally Posted by Ericson
I write a relative path like you, maybe you have to change it in order to make it work.
VB Code:
Name "..\Backups\OptionKeys.reg" as "..\Backups\" & user_specified_filename & ".reg"
When I did this:
VB Code:
Shell "regedit /e ./Backups/OptionKeys.reg HKEY_LOCAL_MACHINE\Software\MyApp\IIP\Option"
Name "..\Backups\OptionKeys.reg" As "..\Backups\" & user_specified_filename & ".reg"
It gives a "Compile Error - Variable Not Defined." For "user_specified_filename"
??
Re: Naming .REG file Help Please
I made that one up, you should replace it with the variable containing the filename the user specified.
If the user put a filename in the textbox text1 then it should look like this:
VB Code:
Name "..\Backups\OptionKeys.reg" As "..\Backups\" & text1.text & ".reg"
Re: Naming .REG file Help Please
Quote:
Originally Posted by Ericson
I made that one up, you should replace it with the variable containing the filename the user specified.
If the user put a filename in the textbox text1 then it should look like this:
VB Code:
Name "..\Backups\OptionKeys.reg" As "..\Backups\" & text1.text & ".reg"
DOH! I'll try that.
Re: Naming .REG file Help Please
Worked!! Thanks!! :thumb: :thumb: