Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / April 2004

Tip: Looking for answers? Try searching our database.

Launching VB forms from Outlook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sarah S - 21 Apr 2004 17:06 GMT
This is my first attemt w/ Outlook and I am using the
provided sample and the book "Microsoft Outlook
Programming. I have been using the sample project ItemsCB
as a base for creating my application.  I added a command
bar button to the MailItem Standard toolbar using this
code:

Set cb = Inspector.CommandBars.Item("Standard")

When that button is clicked, I want to launch a VB 6 form
I designed.  I created my Inspector wrapper class
following the ExplWrap class.  I instantiate my inspector
object as follows and use WithEvents:

Public Property Let Inspector(objInsp As Outlook.Inspector)
On Error Resume Next
  Set m_objInsp = objInsp
  Set m_MailItem = objInsp.CurrentItem
  Set m_colInsps = Outlook.Inspectors
End Property

When a m_colInsps_NewInspector is fired, I see if I need
to add my button.  Things seem to go well up to this
point, but when I click on my button to launch my own
form, I get an error when I try and show the form
using .Show vbModal, Me.

I get error 371 which is:

The specified object can't be used as an owner form for
Show() (Error 371)

You must use an appropriate object with the Show method.

Can I not use my own VB form?  Do I have to make it am
Outlook Custom Designed form?
Sue Mosher [MVP-Outlook] - 21 Apr 2004 17:36 GMT
If "MyForm" is the name of your form, try:

   MyForm.Show vbModal

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> This is my first attemt w/ Outlook and I am using the
> provided sample and the book "Microsoft Outlook
[quoted text clipped - 32 lines]
> Can I not use my own VB form?  Do I have to make it am
> Outlook Custom Designed form?
Sarah S - 22 Apr 2004 15:25 GMT
That did work.  I'm so used to using vbModal, Me that I
didn't even thing of taking the Me off.

I'm having another slight problem w/ my app.  All the
events are firing twice.  I just expanded on ItemsCB by
adding my Inspector wrapper class modeling after the
sample Explorer.  I tried to put in some logic to not fire
them twice, but was unsuccessful.  I will continue to
debug, but any idea as to this?

Thanks.

>-----Original Message-----
>If "MyForm" is the name of your form, try:
[quoted text clipped - 39 lines]
>
>.
Ken Slovak - [MVP - Outlook] - 22 Apr 2004 15:40 GMT
Make sure that each button you add has a unique Tag property. Otherwise you
will get a Click event firing in every wrapper class where you have
instantiated the button. I usually use a fixed button Tag string and append
to that the unique Key value that each Inspector wrapper class is assigned
when it's added to the wrapper collection. That guarantees a unique Tag.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> That did work.  I'm so used to using vbModal, Me that I
> didn't even thing of taking the Me off.
[quoted text clipped - 7 lines]
>
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.