Subscribe to Windows IT Pro
July 17, 2001 12:00 AM

Back to Basics

Windows IT Pro
InstantDoc ID #21522
Rating: (8)

For example, this procedure would work fine as a toolbar macro:

Sub HelloWorld()
  MsgBox "Hello World!"
End Sub

But these wouldn't:

Private Sub HelloWorld()
  MsgBox "Hello World!"
End Sub

Public Sub Hello(strWho)
  MsgBox "Hello " & strWho
End Sub

Public Function Hello()
  strWho = _
    InputBox("Say hi to whom?")
  MsgBox "Hello " & strWho
  Hello = strWho
End Sub

To add a macro to the toolbar, choose View, Toolbars, Customize from the main Outlook menu. On the Commands tab in the Customize dialog box, select Macros from the Categories list. You'll see a list of macros on the right. Copy the desired macro to the toolbar or to an Outlook menu. Right-click the newly created toolbar button or menu command to customize the name, button, and other features.

Adjusting the Security Level
After you've written some VBA code, you might see a message when you start Outlook telling you that the macros can't run because of your security settings or asking you to authorize the macros. Outlook's macro security level determines which message you might see. You can change the security level on the Security dialog box that Figure 2 shows. From the main Outlook menu, select Tools, Macro, Security to open the dialog box.

If you want to use High security, you need to digitally sign your project, much as you might digitally sign an email message. Office 2000 includes the selfcert.exe file, which lets you create a self-signed certificate for signing projects. After you run this program and follow its prompts, you'll have a certificate that you can use to sign any VBA project. To use the self-signed certificate to sign your Outlook VBA project, choose Tools, Digital Signature in the VBA editor. If you don't see the Digital Signature command, you need to run Office Setup to install that option. For more details, read the Microsoft Developer Network (MSDN) article "How to Prevent the VBA Macro Security Warning in Microsoft Outlook 2000" (http://msdn.microsoft.com/library/techart/oldigitalsignature.htm). Note that Microsoft cautions that because no Certificate Authority (CA) backs the self-signed certificate, you should use it to sign only your personal VBA projects.

Ready to get started? Download some code samples and get going.

Related Content:

ARTICLE TOOLS

Comments
  • Anonymous User
    7 years ago
    Jul 14, 2005

    The code above for getting the output of a webpage is excelent... Thanks you.

  • Anonymous User
    7 years ago
    Apr 08, 2005

    I am trying to catch an email when it arrives into Outlook 2002 and then parse the email and save the data (From, To, Subject, etc.) into a SQL Server 2000 DB and am having trouble.

  • Anonymous User
    7 years ago
    Apr 08, 2005

    I am importing the email details from Microsoft Office Outlook 2003. But every time a detail is used from my messages in the inbox, it warns me that a virus may be trying to access my messages and I have to click yes(to allow the program to access it) for every detail that I import. I've tried signing my project but still no success.

  • Anonymous User
    7 years ago
    Mar 14, 2005

    AM SENDING DATA IN OUTLOOK AND MY LANGUAGE IS VBSCRIPT. NOW AM USING THE FIELD CHOOSER TO GET THE CONTACTS BUT WHEN I TRY SENDING THE DATA, ITS TELLING ME THE DESTINATION CC,TO, IS NULL.
    PLEASE NOTE IN THIS ONE BUTTON FOR SEND ITS SAVING DATA IN ACCESS. AM JUST USING THE FIELD CHOOSER TO GET THE CONTACTS FROM THE CONTACT LIST.I DISCOVER THAT THIS CONTROL IS NOT BEING RECOGNISED

  • Anonymous User
    7 years ago
    Jan 31, 2005

    I need help please, i need to measure the response time (service level agreement) so i wish to take the time between the request and the answer. How can i do that for every client?

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.