0
votes

So I am working on setting up a macro to open up a new window in outlook and only show the sub-folders in my inbox. I have a ton of folders and need to have a separate window pop up to help with drag-n-drop emails to these other folders.

Here is the code that i have currently setup. I just dont know how to turn off the main email list (was successful in turning off the preview pane).

sorry if my code is sloppy. i've just been trying to get this hashed out.

Sub anothertesttoopen()
Dim oFolder As Outlook.Folder


For Each oaccount In Application.Session.Accounts
  If oaccount = "email@myemail.com" Then
    Set Store = oaccount.DeliveryStore
    Set oFolder = Store.GetDefaultFolder(olFolderInbox).Folders.Item("Projects 2017") 'here it selects the inbox folder of account.


End If
Next

oFolder.Display


Dim myOlExp As Outlook.Explorer
Set myOlExp = Application.ActiveExplorer
myOlExp.ShowPane olPreview, Not myOlExp.IsPaneVisible(olPreview)


End Sub
1
Why do you have Excel tag?0m3r

1 Answers

0
votes

The Outlook object model doesn't provide any method or property for hiding the grid. Instead, you can display any web page there. The WebViewOn property of the Folder class allows to set a Boolean indicating the Web view state for a folder. It returns True to display the Web page specified by the WebViewURL property of the Folder object. Microsoft Outlook uses the rendering engine of the version Windows Internet Explorer installed on the client computer to display the web page. If Internet Explorer is not installed on the client computer, Outlook will not display the web page. For example:

Sub SetupFolderHomePage()  
 Dim nsp As Outlook.NameSpace  
 Dim mpfInbox As Outlook.Folder  
 Dim mpfNew As Outlook.Folder 

 Set nsp = Application.GetNamespace("MAPI") 
 Set mpfInbox = nsp.GetDefaultFolder(olFolderInbox)  
 Set mpfNew = mpfInbox.Folders.Add("MyFolderHomePage")  
 mpfNew.WebViewURL = "http://www.microsoft.com"  
 mpfNew.WebViewOn = True  
End Sub

Also you may consider creating a solutions module. See Adding Solution-Specific Folders to the Solutions Module in Outlook and Programming the Outlook 2010 Solutions Module for more information.