Macro to view Junk Email folder

Victor Delta

Senior Member
Outlook version
Email Account
POP3
Hi
I wonder if anyone can help with this please. I'm using Outlook 2003 and would like to add another button to the main toolbar which enables me to go to (view) the Junk Email folder - just as if clicking on the folder name in the Folder List on the LHS. I already have a Go Inbox button (using the customise feature) which enables me to go straight to the Inbox and would like to be able to do the same with the Junk Email folder. I frequently need to switch between the two folders.
Sadly the preset option does not exist so presumably I need a macro to do the job. Can anyone help with this please?
Many thanks.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
add this macro to a toolbar button -

Code:
Sub openfolder()
Dim objOlApp As Outlook.Application
Set objOlApp = CreateObject("Outlook.Application")
Set objFolder = Session.GetDefaultFolder(olFolderJunk)
Set objOlApp.ActiveExplorer.CurrentFolder = objFolder 
 
Set objOlApp = Nothing 
 
End Sub
 

Victor Delta

Senior Member
Outlook version
Email Account
POP3
Diane

That’s brilliant, many thanks.

Presumably by changing ‘olFolderJunk’ one could adapt this macro to view any folder. Does one just use the first four letters of a folder’s name?

V
 

Similar threads


Top