Outlook iconVBA icon

Add photos to Contacts in bulk using VBA in Outlook

In Tip 824 Diane Poremsky shows us a bit of VBA that lets you add photos to your contacts in bulk. Let's try and improve the code.

Continue Reading: Add photos to Contacts in bulk using VBA in Outlook »

Outlook icon

Working with the Outlook Recipients collection in VBA

flying email

The Recipients collection is just one of many collections in VBA for Outlook. But as it represents the list of names of people who will receive your message, it's important that you have methods for working with it.

Continue Reading: Working with the Outlook Recipients collection in VBA »

Excel icon

Add and return Excel.Worksheet references in VBA

The Workbooks.Open Method creates a new workbook, adds it to the Workbooks Collection, and returns a Workbook Object which can be set to an object reference. i.e.

Sub TestWorkbookAdd()

Dim wkbks As Excel.Workbooks
Dim wkbk As Excel.Workbook

Set wkbks = Excel.Workbooks
Set wkbk = wkbks.Add

End Sub

From Excel Help:

Creates a new workbook. The new workbook becomes the active workbook. Returns a Workbook object.

Continue Reading: Add and return Excel.Worksheet references in VBA »

Outlook icon

Automatically attach a file to all outgoing messages

Someone on Outlook Code asked about automatically attaching a file to new messages. You could do this two ways:

  1. Create a new message programmatically and attach the file.
  2. Use the ItemSend Event to attach the file to all outgoing messages.

Here I'll demonstrate the first way, since I've already posted code for the second way. (see Attach files to an Outlook email using VBA)

Continue Reading: Automatically attach a file to all outgoing messages »

Outlook iconVBA icon

Look for and create folders programmatically in Outlook

If you are writing VBA code for Outlook, you might have a need to check for an existing folder, and create it if it doesn't exist.

Here are two functions that can assist. I wrote one that checks for an existing folder, and returns TRUE if it exists. It assumes a specific folder hierarchy, so you'll need to adjust it if the folders you are working with are on a different level. Works in Outlook but can be adapted for Excel use as well.

Continue Reading: Look for and create folders programmatically in Outlook »

Site last updated: February 8, 2012