This project has moved. For the latest updates, please go here.

Microsoft Forms library support

Developer
Jan 4, 2013 at 7:40 PM

Why NetOffice doesn't support Microsoft Forms library (FM20.DLL): intentionally or accidentally? VBA project support only by means of VBIDEApi.dll seems to be incomplete without Microsoft forms wrapper. 

I can only use late binding to use UserForm in Outlook addin working with form regions. However Microsoft PIA has Microsoft.Vbe.Interop.Forms.dll.

 

Coordinator
Jan 11, 2013 at 7:50 PM

never heard of FM20.DLL :o

did you have an example solution for me to understand the situation?

Sebastian

Developer
Jan 12, 2013 at 6:36 PM
Edited Jan 12, 2013 at 6:37 PM

There is an example of using Microsoft Forms Library in MSDN article Creating Form Regions:

using Forms = Microsoft.Vbe.Interop.Forms;
...
void InitalizeControls()
{
    try
    {
        // Locate control references.
        LabelFFN = 
            UserForm.Controls.Item("LabelFFN") as Outlook.OlkLabel;
        TextBoxFFN = 
            UserForm.Controls.Item("TextBoxFFN") as Outlook.OlkTextBox;
        LabelPreferredAirline = 
            UserForm.Controls.Item("LabelPreferredAirline") 
            as Outlook.OlkLabel;
        TextBoxPreferredAirline = 
            UserForm.Controls.Item("TextBoxPreferredAirline") 
            as Outlook.OlkTextBox;
        LabelSeatPref = 
            UserForm.Controls.Item("LabelSeatPref") 
            as Outlook.OlkLabel;
        ComboBoxSeatPref = 
            UserForm.Controls.Item("ComboBoxSeatPref") 
            as Outlook.OlkComboBox;
        LabelLastPurchase = 
            UserForm.Controls.Item("LabelLastPurchase") 
            as Outlook.OlkLabel;
        TextBoxLastPurchase = 
            UserForm.Controls.Item("TextBoxLastPurchase") 
            as Outlook.OlkTextBox;
        ButtonNewItinerary = 
            UserForm.Controls.Item("ButtonNewItinerary") 
            as Outlook.OlkCommandButton;
        ButtonEditItinerary = 
            UserForm.Controls.Item("ButtonEditItinerary") 
            as Outlook.OlkCommandButton;
        ButtonDeleteItinerary = 
            UserForm.Controls.Item("ButtonDeleteItinerary") 
            as Outlook.OlkCommandButton;
        ListItineraries = 
            UserForm.Controls.Item("listItineraries") 
            as Outlook.OlkListBox;
        Forms.Frame Frame2 = 
            UserForm.Controls.Item("Frame2") as Forms.Frame;
        Frame2.BorderStyle = 
            Microsoft.Vbe.Interop.Forms.fmBorderStyle.
            fmBorderStyleNone;
        Frame2.ScrollBars = 
            Microsoft.Vbe.Interop.Forms.fmScrollBars.fmScrollBarsNone;
...
    }
    catch (Exception ex)
    {
        Debug.WriteLine ("An error occured while hooking up 
        Form Region controls: " + ex.Message);
    }
}
You can download Outlook sample add-in and look at the following files in the TravelAgencyAddinCS folder:
  • BaseFormRegionWrapper.cs
  • FormRegionWrapper.cs