|
-
Nov 23rd, 2006, 07:15 AM
#1
Thread Starter
Lively Member
[RESOLVED] Naming .REG file Help Please
Hi All! I'm new to programing and VB ( Well, did do a bit of batch file work back in the bad ol' day of DOS!).
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!
-
Nov 23rd, 2006, 07:58 AM
#2
Member
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"
-
Nov 23rd, 2006, 08:09 AM
#3
Thread Starter
Lively Member
Re: Naming .REG file Help Please
 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"
??
-
Nov 23rd, 2006, 08:19 AM
#4
Member
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"
-
Nov 23rd, 2006, 08:41 AM
#5
Thread Starter
Lively Member
Re: Naming .REG file Help Please
 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.
-
Nov 23rd, 2006, 08:56 AM
#6
Thread Starter
Lively Member
Re: Naming .REG file Help Please
Worked!! Thanks!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|