UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Set Folder View Of Outlook Application From Access VBA, Office 2013    
 
   
V1sitat1on
post Oct 26 2018, 04:59 PM
Post#1



Posts: 1
Joined: 9-December 17



I am using VBA in an Access module to create folders in Outlook.

The folders I create are located in a structured arrangement which has multiple layers (folder/subfolder/subfolder etc).

The code I have does this as I need, but the Outlook Application instance does not automatically set its folder view to display my new Outlook (sub) folder.

I need to be able to open the new folder from an access command button, but I can't figure out how to do it - and I find no helpful reference anywhere.

So my question is: How do (Can) I make Outlook set its active view to focus to a specified (sub)folder from Access VBA?

(Using Office 2016 but can only select 2013 in the Version drop-down here)

Thank you!
Go to the top of the page
 
ADezii
post Oct 26 2018, 06:24 PM
Post#2



Posts: 2,466
Joined: 4-February 07
From: USA, Florida, Delray Beach


Let's assume that you wanted to create an Instance of Outlook, open the 'Important' Folder that is one level under the Inbox, display the contents of the 'Important' Folder, then print the TO, SUBJECT, and BODY Fields for every E-Mail in that Folder:
CODE
Dim oOut As Outlook.Application
Dim oMailItem As Outlook.MailItem
Dim oFldr As Outlook.MAPIFolder


Set oOut = New Outlook.Application

'To access the 'Important' Folder under Inbox
Set oFldr = GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders("Important")
      oFldr.Display

For Each oMailItem In oFldr.Items
  Debug.Print "TO: " & oMailItem.To
  Debug.Print "SUBJECT: " & oMailItem.Subject
  Debug.Print "BODY: " & oMailItem.Body
  Debug.Print "---------------------------------------------------------------------------"
Next

Set oOut = Nothing
Set oMailItem = Nothing
Set oFldr = Nothing
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    23rd July 2019 - 02:00 AM