Share via


Using My in Visual Studio Tools for Office Projects

In Visual Basic, you can use the keyword My to quickly and easily access information and default object instances that are related to the application and its run time environment. Visual Studio Tools for Office projects enable the use of the My keyword with the same functionality that is available in a Class Library project, which is a subset of the My objects supported in Windows Application projects.

My Objects in Visual Studio Tools for Office Projects

The following My objects are available in Visual Studio Tools for Office projects.

Application

Provides properties, methods, and events related to the current application. For more information, see My.Application Object.

User

Provides access to the current user's security context. My.User is not set by default in Visual Studio Tools for Office projects. The output of a Visual Studio Tools for Office project is a DLL file that can potentially be called from multiple copies of an Office document. To get the correct user identity, you must add the following code to set the identity to that of the user running the application that is calling the DLL file:

My.User.InitializeWithWindowsUser()

For more information, see My.User Object.

Computer

Provides properties for manipulating computer components, such as audio, the clock, the keyboard, and the file system. For more information, see My.Computer Object.

WebServices

Provides properties for creating and accessing a single instance of each XML Web service referenced by the current project. All of the My.Webservices functionality is included. For more information, see My.WebServices Object.

Settings

Provides access to the application's settings and allows you to dynamically store and retrieve property settings and other information for your application. My.Settings functionality is included. For more information, see My.Settings Object.

Resources

Provides access to the application's resources and allows you to dynamically retrieve resources for your application. My.Resources functionality is included. For more information, see My.Resources Object.

See Also

Concepts

Development with My

Other Resources

Getting Started (Visual Studio Tools for Office)