Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site

       How did you like this article? Please vote and let us know.          

Subscribe to OutlookExchange
Anderson Patricio
Ann Mc Donough
Bob Spurzem
Brian Veal
Catherine Creary
Cherry Beado
Colin Janssen
Collins Timothy Mutesaria
Drew Nicholson
Fred Volking
Glen Scales
Goran Husman
Guy Thomas
Henrik Walther
Jason Sherry
Jayme Bowers
John Young
Joyce Tang
Justin Braun
Konstantin Zheludev
Kristina Waters
Kuang Zhang
Mahmoud Magdy
Martin Tuip
Michael Dong
Michele Deo
Mitch Tulloch
Nicolas Blank
Pavel Nagaev
Ragnar Harper
Ricardo Silva
Richard Wakeman
Russ Iuliano
Santhosh Hanumanthappa
Shannal L. Thomas
Steve Bryant
Steve Craig
Todd Walker
Tracey J. Rosenblath

 

 
 

VB5 ActiveX DLL Folder Dialog Example

This example illustrates the use of ActiveX DLL components created with Visual Basic 5.0 to display modal custom dialog boxes in Outlook 97 forms.

Before You Run the VB5 ActiveX DLL Folder Dialog Example


A. Install the OutlookComponents ActiveX DLL

To install the OutlookComponents ActiveX DLL:

  1. Extract the self-extracting outlcomp.exe into an empty folder.
  2. Use Explorer to navigate to the folder where you extracted outlcomp.exe and double-click Setup.exe.
  3. Setup will install the OutlookComponents.dll into your system and register the component.

B. Install VBScript version 2.0

The VBScript code in this sample application utilizes functions in VBScript version 2.0. If you have not already upgraded your version of VBScript, connect to
http://www.microsoft.com/vbscript in order to download VBScript version 2.0.

C. Install the VB5 ActiveX DLL Folder Dialog Example Form.

This form is provided as an Outlook template in the self-extracting file outlcomp.exe.

  1. Use the Explorer to open the template file named VB5 ActiveX DLL Folder Dialog Example Form in the folder where you extracted outlcomp.exe.
  2. Select the folder where you want to post the VB5 ActiveX DLL Folder Dialog Example Form.
    You will see the Enable/Disable macros warning since this form is not installed in either your Personal or Organizational Forms Registry. Select the Enable Macros command button.
  3. Click the Post button on the form to post the form into the folder you selected in step 2.

D. Methods and Properties of the OutlookComponents Dialogs Class

Properties:

CancelDialog (Read-Only)
TRUE if the dialog was canceled by the user; FALSE if the user clicked the OK button or double-clicked a folder in the TreeView.

FolderID (Read-Only)
Returns the EntryID of the folder selected by the user.

FolderName (Read-Only)
Returns the Folder name of the folder selected by the user.

Methods:

LoadFoldersDialog([Caption As String], [LabelCaption As String])
Loads the dialog box and fills the TreeView with all the folders in the current user's profile. The Caption is the dialog box caption. The Label Caption sits over the treeview and prompts the user for an action such as "Select folder to copy to". Named arguments are optional.

RefreshFolders
Refreshes the TreeView control with all the folders in the current user's profile. Use this method if folders must be current before you use the ShowFoldersDialog method.

ShowFoldersDialog([Caption As String], [LabelCaption As String], [SelectedFolderEntryID As String])
Shows the dialog box. The SelectedFolderEntryID allows you to specify the MAPI EntryID of the folder you want to be selected when the dialog is visible. Remember that this dialog is always modal. Named arguments are optional. If you do not supply a SelectedFolderEntryID, the root node of the TreeView is selected. Default form caption is "Select Folder" and "Folders:" is the default LabelCaption.

E. Using the OutlookComponents Dialogs Class in Outlook Forms

The VBScript code to display the Folders dialog is fairly straightforward. Open the VB5 ActiveX DLL Folder Dialog Example Form and select Tools | Design Outlook Form command and then select Form | View Code command. You can cut and paste this code into your own custom Outlook forms. Remember to call the LoadFoldersDialog method in the Item_Open event of your form in order to increase performance when you actually need to display the Folders dialog to your user.

F. Running the Visual Basic® 5.0 Source Code

  • You must have either Visual Basic 5.0 Professional or Enterprise edition installed.
  • Unzip outlcompvb.exe to a directory where you will store this project.
  • Double-click OutlookComponents.vbp in the directory where you unzipped Outlcompvb.exe.
  • When the project loads, you will see an Alert Box warning you that VB was "Unable to set the Version Compatible Component." Press OK to dismiss this warning. Setting the version compatible component ensures that each time you compile your component you do not create a separate ClassID in the registry. The version compatible component is now set to No Compatibility in the Version Compatibility frame.
  • Select the Project | OutlookComponents Properties command, click the Component tab, and select the Compatibility tab. If you want to recompile the component, you should set Version Compatibility option to Binary Compatibility. See "When Should I Use Version Compatibility?" in Visual Basic® 5.0 Books Online.

A Note about comctl32.ocx used in OutlookComponents Project:

If you have a problem running the OutlookComponents Project because your comctl32.ocx does not match the version of comctl32.ocx registered in this project, you should upgrade to version 5.00.3828 of comctl32.ocx. To obtain the latest version of COMCTL32.OCX, see the following article in the Microsoft Knowledge Base at
http://www.microsoft.com/kb

ARTICLE-ID: Q167121
TITLE : FILE: Updated COMCTL32.OCX Version 5.00.3828 Available


Acknowledgements

VB5 ActiveX DLL Folder Dialog Example Form
This application was created by:
Randy Byrne, MCSD Charter Member, MVP Outlook 97
Micro Eye, Microsoft Solution Provider Member
randy_byrne@msn.com
microeye@ncal.net

A member of the Microsoft Solution Provider program since its inception, Micro Eye specializes in the custom development of workflow applications for enterprise clients. Outlook custom forms, ActiveX documents, and Office 97 Automation create a powerful environment for information sharing and workgroup collaboration. Micro Eye has the ability to combine these client-side resources with the scalable components of BackOffice-SQL Server, Internet Information Server, Transaction Server, and Exchange-to create the next generation of groupware for your organization.

To download outlcompvb.exe, the user must have either Visual Basic 5.0 Professional or Enterprise editions. This version is for Outlook developers who do not have VB5 Enterprise or Professional edition and who simply want to test the OutlookComponents ActiveX component.
zip.gif
Link to OUTLCOMPVB.ZIP
(35K)
zip.gif
Link to OUTLCOMP.EXE
(1717K)

Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Pro Exchange. OutlookExchange.Com and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

© Copyright Pro Exchange, Inc., 2006