To field passed to HTML form

  • Thread starter Thread starter Ketta
  • Start date Start date
K

Ketta

I know this is probably a very basic Outlook programming function but I am
really having difficulty finding information on form programming. I know a
intermediate level of VB.NET and all but Outlook programming is completely
foreign to me. I want to make a form (probably using the new mail message
form) and take the "To" field and send the e-mail addresses contained in
that to an HTML form. I can make a custom button that launches the HTML
form with the POST information. But I need that TO field data in a variable
or something so I can pass it. I apologize if this is out of the scope of
this forum but I cannot find anything relevant online that is a free Outlook
programming resource.

Thanks
 
The addresses are in the MailItem.Recipients collection for that item.
You'll have to iterate the collection and extract the address from each
Recipient object in the collection.
 
See that is what I thought... but I wrote this simple code to say how many
recipients there are, I receive a message saying "Object Required:
MailItem". I have one person in the "To" field. I guess I should have
pasted that first.

Public Sub OK_Click()
Dim recips
recips = MailItem.Recipients.Count
MsgBox (recips)
End Sub
 
MailItem is the name of an Outlook object. Your code needs to instantiate an
object *variable* that represents the particular MailItem object that you
want to work with. If you're working with the currently displayed item, and
you have already instantiated an Outlook Application object (call it objOL),
you would use this VB.Net code to get the current item:

objInsp = objOL.ActiveInspector
If Not objInsp Is Nothing Then
objItem = objInsp.CurrentItem
End If

Note that you cannot predict what type of item CurrentItem will return.
Check the item's Class property before you invoke any proeprties or methods
specific to MailItem or any other type of item.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top