Programmatically Opening Outlook

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
 
K

Ken Slovak - [MVP - Outlook]

See if adding a NameSpace.Logon statement helps, and also see if using
the StoreID of the public folder helps in the GetFolderFromID method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top