How to make the Inbox Active within a Macro?

  • Thread starter Thread starter Cumulous
  • Start date Start date
C

Cumulous

Hi! I have a simple question for you. I have a macro (for Outlook
2003) that moves around emails between different folders, and eliminates the
New Mail Envelope Icon in the System Tray.

I would like to modify this macro so that when it finishes, it will
change the focus to a particular folder (for example, the main InBox). What
do I need to add in order to accomplish this?

Keep in mind that for the scenario in question, there are multiple PSTs
attached to the Profile in question. So we need some way to specify that
we're talking about the Primary PST.

Anybody willing to help me with the code snippets I'd need?

Thanks! :)



Cumulous
 
You can use Namespace.GetDefaultFolder to return the default Inbox folder,
then set Application.ActiveExplorer.CurrentFolder to that folder.
 
Thanks for responding, Sue. :)

Unfortunately when I add the lines...

--------------------------
NameSpace.GetDefaultFolder
Application.ActiveExplorer.CurrentFolder
--------------------------

... and run the macro, I get an error - "Compile Error: Invalid use of
property".


Any ideas?
 
Namespace is the name of an object in the Outlook object model. You need to
first instantiate an instance of that object before you use its properties
and methods. How are you instantiating your Outlook.Application object? If
you already have an Outlook.Application object named objOL, then to get the
Namespace, use:

Set objNS = objOL.GetNamespace("MAPI")

After that you can use the properties and methods of your objNS Namespace
object.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Got it. Thanks! :)




Cumulous



Sue Mosher said:
Namespace is the name of an object in the Outlook object model. You need to
first instantiate an instance of that object before you use its properties
and methods. How are you instantiating your Outlook.Application object? If
you already have an Outlook.Application object named objOL, then to get the
Namespace, use:

Set objNS = objOL.GetNamespace("MAPI")

After that you can use the properties and methods of your objNS Namespace
object.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top