-
Controls in a Class
I am trying to make a Class to send a simple email using MAPI. I can do it with a form, but I can't figure out how to do it with a class. What do you have to add in the class since you can't drag and drop the MAPISession and MAPIMessages Controls onto the class like you can the form?
Here is the code that works when its not in a class.
Code:
MapiSession1.SignOn
MAPIMessages1.SessionID = MapiSession1.SessionID
MAPIMessages1.Compose
MAPIMessages1.RecipDisplayName = m_MailTo
MAPIMessages1.MsgSubject = m_MailSubject
MAPIMessages1.MsgNoteText = m_MailMessage
MAPIMessages1.ResolveName
MAPIMessages1.Send
Thanks in advance.
-
In order to use a control you need to have a form.
-
Welcome to the Forums.
I think you may be asking this question because you dont
need/want to show a form and if so, you could use a form but set
its visibility property to false.
HTH
-
Instantiate the class, call its functions which encapsulate the code you've pasted above, pass the right parameters. Almost the same thing.