Question : PrivateProfileString

Hi
What is the equivalent for Word's PrivateProfileString in Excel. I know that there is a similar Proerty in Excel but I just can't remeber what it is .......


Peter

Answer : PrivateProfileString

Hi Forsborn,

There is no equivalent for PrivateProfileString in Excel.

What you can use though for your own registry keys is the SaveSetting property. This will let you read and write registry keys and values inside the HKEY_CURRENT_USER\Software\VB and VBA Program Settings\ registry part.

Example:

SaveSetting("MyApp","MySubPart","MyKey","18")

will assign the value 18 to the key MyKey in the registry location



To read the value of this key:

MyVariable = GetSetting("MyApp","MySubPart","MyKey")

Good LuckHKEY_CURRENT_USER\Software\VB and VBA Program Settings\MyApp\MySubPart

Calacuccia

P.S. To create sublocations, just do like this:

SaveSetting("MyApp","MySubPart\Sub2\Sub3","MyKey","18")

This will assign the string "18" to the key "MyKey" at location HKEY_CURRENT_USER\Software\VB and VBA Program Settings\MyApp\MySubPart\Sub2\Sub3


Random Solutions  
 
programming4us programming4us