Microsoft Office Automation VBA

How to automate Outlook by using Visual Basic  August 29, 2013 – 00:26
AUTHOR_PHOTO2004831221348197.jpg

This article demonstrates how to programmatically control Microsoft Outlook using Automation from Visual Basic. The example shows the creation of contacts and appointments, and sending messages to the object model of Microsoft Outlook.

Follow these steps to create and run the sample. To run the example, you need a reference at compile time linked to a type library for Microsoft Outlook. The following table shows the file names of the type libraries of different versions of Microsoft Outlook: Collapse this table Expand this table

Version of Outlook: How the type library appears in the list of references Filename
Outlook 97 "Object Library Microsoft Outlook 8.0" msoutl8.olb
msoutl8.olb "Object Library Microsoft Outlook 98" msoutl85.olb
Outlook 2000 "Object Library Microsoft Outlook 9.0" Msoutl9.olb
Outlook 2002 "Object Library Microsoft Outlook 10.0" msoutl.olb
Office Outlook 2003 "Object Library Microsoft Outlook 11.0" msoutl.olb

Example automation generate

  1. Start Visual Basic and create a new Standard EXE project.
  2. On the Project menu, choose References and select Microsoft Outlook.
  3. Add a button to your form.
  4. Double-click the button and then add the following code:

    'Start Outlook. 'If it is already running, use the same instance ... September olApp As Outlook.Application Dim olApp = CreateObject ("Outlook.Application") 'Logon. No matter if you are already running and logged on ... Dim As Outlook.NameSpace September olns olns = olApp.GetNamespace ("MAPI") olNs.Logon 'Create and open a new contact. Dim As Outlook.ContactItem September olItem olItem = olApp.CreateItem (olContactItem) 'Configure the contact information ... With olItem. FullName = "James Smith." Birthday = "9/15/1975". CompanyName = "Microsoft". HomeTelephoneNumber = "704-555-8888". Email1Address = "alguien@microsoft.com." JobTitle = "Developer ". HomeAddress =" 111 Main St. " & VbCr & "Charlotte, NC 28226" End With 'Save the contact ... olItem.Save 'Create a new appointment. Dim As Outlook.AppointmentItem September olAppt olAppt = olApp.CreateItem (olAppointmentItem) 'Set the start time 2 minutes from now ... olAppt.Start = Now () + (2 # / 24 # / 60 #) 'Setup other appointment information ... With olAppt. Duration = 60. Subject = "Meeting to discuss plans ..." . Body = "Meeting with" & olItem.FullName & "to discuss plans." . Location = "Home Office". ReminderMinutesBeforeStart = 1. ReminderSet = True End With 'Save the date ... olAppt.Save 'Send a message to the new contact. As Outlook.MailItem Dim September olMail olMail = olApp.CreateItem (olMailItem) 'Fill and send the message ... olMail.To = olItem.Email1Address olMail.Subject = "About our meeting ..." olMail.Body = _ "Dear / a" & olItem.FirstName & ", " & vbCr & vbCr & vbTab & _ "I'll see you in two minutes at the meeting." & VbCr & vbCr & _ "Btw: I've added to my contact list." OlMail.Send 'Clean ... MsgBox "All done ..." olNS.Logoff September vbMsgBoxSetForeground olns = Nothing Set olAppt olMail = Nothing Set = Nothing Set olItem = Nothing Set olApp = Nothing

  5. Run the project and click the button to run the code.

Source: support.microsoft.com


jablotron 100

You might also like:

SQL Select Statement in VBA - .ExcelVBASQL.com 38+ hours of
SQL Select Statement in VBA - www.ExcelVBASQL.com 38+ hours of ...
Use VBA to Add A Chart - Download files at ExcelVBASQL.com!
Use VBA to Add A Chart - Download files at ExcelVBASQL.com!

Microsoft automation

Means using macros/visual basic to carry out tasks.
All MS Office products can run vba scripts, and you can also tell one program to command another program to do something.
For example, running vba code in Access that will:
1) Start Excel
2) Go through all the records in a table
3) Insert data into a spreadsheet
4) Format the spreadsheet columns, borders, fonts, colors

That's nice.

How exactly do your web based operating system independent applications deal with seamless automation of Microsoft office products? Furthermore, what makes learning VBA mutually exclusive from learning .NET? VBA pays good money today and will continue to pay good money for at least another few years.
You seem really, really, REALLY mired in your own career path and unable to envision any other possible way to make money.

A novice's guide to backing up a PC  — ITProPortal
There's also an Outlook 2007/2003/2002 add-in from Microsoft called Personal Folders Backup that does just what it says. Follow these instructions from ..

YBDS, LLC The Complete MS Access VBA Cookbook
eBooks (YBDS, LLC)

Related posts:

  1. Microsoft Office Automation using c
  2. Microsoft Office Automation tools
  3. Microsoft Office Automation Word