Question : Reading and Writing a decimal number to and from the registry through an Excel UserForm

I would like to post a decimal number into a made up registry through a UserForm1 txtNumber textbox by the click of cmdPostNumber.

I would then like to populate this txtNumber textbox on UserForm1 Initilize with what is stored in the registry.

Can an expert suggest the correct lines of vba code for these two events please.

Many thanks and a happy christmas to you all.

Answer : Reading and Writing a decimal number to and from the registry through an Excel UserForm

Hi Peter,

Although it's tempting to write values to the Registry it is much easier to write them to an xlSheetVeryHidden (if you want to keep them secret).

Having said that the attached file has the code you will need - modify as required. Code also below...

Patrick
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Sub savedatatoregistry()
    'Enter any value in to any cell before running this macro
    SaveSetting "Registry_Saving02", "MyData", "Detail01", Selection
    SaveSetting "Registry_Saving02", "MyData", "Detail02", Selection.Address
End Sub

Sub getdatatfromregistry()
    Sheets("Sheet1").[a1] = GetSetting("Registry_Saving02", "MyData", "Detail01", 0)
    Sheets("Sheet1").[a2] = GetSetting("Registry_Saving02", "MyData", "Detail02", 0)
End Sub
Random Solutions  
 
programming4us programming4us