Saving the Text Tools utility settings

The Text Tools utility has a very useful feature: It remembers the last settings that you used. This is handy because most people tend to use the same option each time that they invoke it.

As I mentioned, the most recent settings are stored in the Windows Registry. When the user clicks the Close button, the code uses VBA's SaveSetting function to save the value of each control. When the Text Tools utility is started, it uses the GetSetting function to retrieve those values and set the controls accordingly. In the Windows Registry, the settings are stored at the following location:

HKEY_CURRENT_USER\Software\VB and VBA Program Settings\ Text Tools Utility\Settings

Figure 16-6 shows these settings in the Windows Registry Editor program

(regedit.exe).

File Edit View Favorites Help f^m ffl-Q Loan Amortization Wizard i Ö-LJ MosASCII32 i iü MSFilter ffl'O Power Utility Pak m-T~l SigmaPlot i Ö-LJ SystStf.aer j Ö-Q3 Text Tools Utility Settings ffl-T~l ThreeDGraphics i ¿-a xl ffl-n vbaccelerator ffl-n Windows Magazine l~~l Xara

[^(Default)]

REG.

_5Z

SÎAddTextlndex

REG.

_5Z

Ifj^ChangeCaselndex

REG.

_5Z

Ifj^CharsToRemovelndex

REG.

_5Z

Operationindex

REG.

_5Z

If®] RemoveCharactersIndex

REG.

_5Z

Ifî3 RemovePosition Index

REG.

_5Z

© Remove5pacesIndex

REG.

_5Z

If^TextToAdd

REG.

_5Z

|My Computer \HKEY_CUR RE NT_U5ER\5oftware\VB and VBA Program 5ettings\Text Tools Utility\Settings jJ

Figure 16-6: Use the Windows Registry Editor program to view the settings stored in the Registry.

If you examine the code for Text Editor, you'll find that I used an array (named UserChoices) to store the settings. I could have used separate variables for each setting, but using an array made the coding a bit easier.

0 0

Post a comment