Control Excel Options

All of the Excel settings and options can be controlled in code through Application object properties. Quite a few of the Application properties are devoted to Excel settings and options, but you only occasionally need to change these settings in code-- it is usually a better idea to let the users maintain their own settings.

Use Application.InputBox to get ranges and formulas

Figure 7-1. Use Application.InputBox to get ranges and formulas

If you do change Excel options in code, it is polite to restore the user’s settings when you are done. To do that, save the original setting in a module-level variable and restore that setting before exiting.

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.