Finance

Charts

Statistics

Macros

Search

Using AutoCorrect with Excel VBA

AutoCorrect allows you to automatically replace certain typed characters (words) or abbreviations that were previously defined in the AutoCorrect dialog box.

The AutoCorrect property of the Application object returns an AutoCorrect object, which allows you to manage auto-correction on the worksheet. The properties of this object configure the parameters set in the AutoCorrect dialog on the AutoCorrect tab in the Replace as you type group: go to the File tab of the ribbon, click Options, in the Excel Options window select Proofing on the left, and in the AutoCorrect options group on the right, click the AutoCorrect Options button next to Correct spelling and formatting as you type.

For example, in the following code, the first procedure handles the Open event of the workbook and adds three new items to the AutoCorrect list. Specifically, спб will automatically be replaced with Санкт-Петербург, мск with Москва, and гр with Гродно. The second procedure handles the BeforeClose event triggered when closing the workbook, removing these three items from the AutoCorrect list.

0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx