Code works in one case, but not in a similar case (registry editing). Help?

Printable View