Open folder with vba code launches a new window

L

LDMueller

I have Outlook 2003. Basically I have an email in my inbox and when I run
this macro, I want the email to be moved to the folder "Problem
Report\Laptop" and then open this folder. My code works fine, but it's the
last line
(e.g. objFolder.Display) that I don't like. I want to open the folder, but
not launch a new window. If I manually open different folders, new windows
don't open so I'm hoping to do the same with code. I'm limited to what I
know with VBA so this was the only code I could at least get working.

Here is my code:

' Opens folder Problem Report\Laptop
Dim objOlApp As Outlook.Application
Dim objRecipient As Outlook.Recipient

Set objOlApp = CreateObject("Outlook.Application")
Set objNS = objOlApp.GetNamespace("MAPI")
Set objRecipient = objNS.CreateRecipient("Problem Report")

Set objFolder = GetFolder("Mailbox - Problem Report\Laptop")
objFolder.Display 'Will launch new window

Any assistance would be greatly appreciated.

Thanks!
 
S

Sue Mosher [MVP-Outlook]

Use this statement instead:

Set objOLApp.ActiveExplorer.CurrentFolder = objFolder

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
L

LDMueller

Perfect! Thank you so much Sue.

LDMueller

Sue Mosher said:
Use this statement instead:

Set objOLApp.ActiveExplorer.CurrentFolder = objFolder

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top