Mark, if the sub is in the same dvb (project)as the code I said to put in a standard module, when you hit the line
WriteStringValue HKEY_CURRENT_USER, KeyName, valueName, dataValue
it will look for the sub WriteStringValue and find it in the module, that in turn will look for the Const HKEY_CURRENT_USER, and find it in the same module.
You can drag out the applicable code to make it smaller but having the whole module is great for doing other work requiring registry writing reading etc.
Api's work a little different than regular code, often you pass them an empty variable, long or whatever and they fill that variable with what you need. But they have a structure that you don't want to mess with. If you copy all the code into one module it will work fine