Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-05-2022, 07:03 PM
AlanCantor AlanCantor is offline VBA Code to Jump to a Folder Windows 10 VBA Code to Jump to a Folder Office 2019
Competent Performer
 
Join Date: Nov 2020
Posts: 137
AlanCantor is on a distinguished road
Default

Hope these code snippets for Inbox, Outbox, and Sent Messages get you at least part-way to your destination!



Code:
Attribute VB_Name = "GotoOutlookFolders"
Sub GotoInbox()
 Dim objOlApp As Outlook.Application
 Set objOlApp = CreateObject("Outlook.Application")
 
 Dim objFolder As Outlook.Folder
 Set objFolder = Session.GetDefaultFolder(olFolderInbox)
 Set objOlApp.ActiveExplorer.CurrentFolder = objFolder
 Set objFolder = Nothing
 Set objOlApp = Nothing
End Sub
Sub GotoOutbox()
 Dim objOlApp As Outlook.Application
 Set objOlApp = CreateObject("Outlook.Application")
 
 Dim objFolder As Outlook.Folder
 Set objFolder = Session.GetDefaultFolder(olFolderOutbox)
 Set objOlApp.ActiveExplorer.CurrentFolder = objFolder
 Set objFolder = Nothing
 Set objOlApp = Nothing
End Sub
Sub GotoSent()
 Dim objOlApp As Outlook.Application
 Set objOlApp = CreateObject("Outlook.Application")
 
 Dim objFolder As Outlook.Folder
 Set objFolder = Session.GetDefaultFolder(olFolderSentMail)
 Set objOlApp.ActiveExplorer.CurrentFolder = objFolder
 Set objFolder = Nothing
 Set objOlApp = Nothing
End Sub

Reply With Quote
Reply

Tags
folder, macro, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code to run macro across all documents in folder rmk911 Word VBA 11 04-25-2018 02:38 PM
VBA Code to Jump to a Folder Code to update macros automatically in startup folder dwirony Word VBA 4 01-12-2017 08:23 AM
VBA Code to copy file to folder and keep the original. staicumihai Word VBA 3 10-31-2016 03:07 AM
VBA Code to Jump to a Folder vba code for folder name, subfolder directory, file name & revision times klpw Excel Programming 2 12-24-2015 12:31 AM
Macro code should find inv no in folder and send attachhed mail. visha_1984 Outlook 0 01-30-2013 05:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:25 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft