The way to get to all of the properties is to do this:-
In the VB Editor click Tools, References and choose Microsoft Outlook n.x Object Library (where n and x will depend on your version).
You can then change your code to this:-
Code:
Sub CreateAnAutoEmail()
Dim olApp As Outlook.Application, olMail As Outlook.MailItem
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = "someone@somewhere.com"
olMail.Body = "This is the body"
olMail.Subject = "And here is the subject"
'You can specify other properties e.g.
olMail.Attachments.Add "C:temppoo.txt"
olMail.DeleteAfterSubmit = True
olMail.Send
'and so on, there are loads of them.
End Sub
What you've done now is used early binding, rather than late binding (I used late binding for simplicity). Setting a reference to the Outlook object library means that all constants, properties,methods and events of Outlook will now be available to your application. For example, in your code after the line olMail.Subject type olMail. as soon as you type the full stop (or period but I'm English
) all of the properties and methods of the Outlook Mailitem will be shown in a drop down list. It's probably best to just play around and experiment until you get your code the way you want.
Another way of seeing what's available is to use the object browser (F2). Here you can view all classes currently available to your project. It may seem a little confusing if you haven't used it before but once you understand it, it's one of the most useful tool in developing your apps. If you have any more questions just ask.
Regards,
D
[ This Message was edited by: dk on 2002-02-25 10:19 ]
Like this thread? Share it with others