Programmatically Opening Outlook

  • Thread starter Thread starter Chuck Walker
  • Start date Start date
C

Chuck Walker

I have an appointment app that is creating an item in the public folders of
Outlook from Access. If Outlook is running, no problem. But if Outlook is
not running, the code should be starting Outlook but doesn't seem to start
it properly and the app returns an error while trying to access the Outlook
object.

I have included a snippet of the code for someone to look at and see what I
may be doing wrong.

Thanks for any help.

Dim olFolder As Outlook.MAPIFolder
Dim olApp As Outlook.Application
Dim olAppt As Outlook.AppointmentItem
Dim NS As Outlook.NameSpace

'Open and create Outlook Item
Set olApp = CreateObject("Outlook.Application")
Set NS = olApp.GetNamespace("MAPI")
Set olFolder = NS.GetFolderFromID (wrkResourceFolderID)
'wrkFolderID is working variable with a previously defined Outlook Folder ID
Set olAppt = olFolder.Items.Add
 
See if adding a NameSpace.Logon statement helps, and also see if using
the StoreID of the public folder helps in the GetFolderFromID method.
 
Back
Top