dbTalk Databases Forums  

Access and Outlook. Stop prompt for Profile name?

comp.databases.ms-access comp.databases.ms-access


Discuss Access and Outlook. Stop prompt for Profile name? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Salad
 
Posts: n/a

Default Access and Outlook. Stop prompt for Profile name? - 01-29-2011 , 11:35 PM






I have an application I wrote to view Outlook emails. When I wrote it I
always had Outlook open. It works as expected. My problem is if
Outlook is closed. It prompts me for my Profile name after initially
prompting me for it.

I have some standard code.
Dim oldApp As Object
Set olApp = GetOutlookObject()

This calls a function that looks like this
Public Function GetOutlookObject() As Object
On Error Resume Next
Set GetOutlookObject = CreateObject("Outlook.Application")
If Err.Number <> 0 Then
On Error GoTo 0
On Error Resume Next
Set GetOutlookObject = GetObject(, "Outlook.Application")
End If
End Function

Where I get prompted for selecting an Outlook Profile name is usally at
code such as this where I am getting the folders.
Dim olApp as Object
Dom olName As Object
If Not TypeName(olApp) = "Nothing" Then
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olFolders = olNameSpace.Folders 'prompts for profile

I am not sure why the olFolders line prompts me. Is there any method of
automation where can get my Outlook folder and not be prompted to select
my Profile?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.