View Single Post
  #5  
Old March 22nd 07, 05:07 PM posted to microsoft.public.outlook.program_vba
CES
external usenet poster
 
Posts: 10
Default Open Outlook's inbox with VBA

Michael Bauer [MVP - Outlook] wrote:

From any Office application, go to Tools/References and select Microsoft
Outlook... from the list.

If it's really necessary to have Outlook visible then modify your code a
little bit:

Dim Olook As Outlook.Application
Set Olook = CreateObject("Outlook.Application")
Olook.Explorers.Add



Michael,

I've added a reference to the Microsoft Outlook 12.0 Object Library as you suggested however I am still getting errors.


Public Sub test_Click()

Dim oL As Outlook.Application
Set oL = CreateObject("Outlook.Application")

'Either of these will throw an error
'oL.Explorers.Add ' Compile Error = "Argument not Optional"
'oL.Application.Visible = True ' Run-time error 438 = Object dosent support this property or method

End Sub

If by any chance you have a clue what else might be going wrong I would appreciate your help. - CES
Ads