How to make the Inbox Active within a Macro?

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
 
S

Sue Mosher [MVP-Outlook]

You can use Namespace.GetDefaultFolder to return the default Inbox folder,
then set Application.ActiveExplorer.CurrentFolder to that folder.
 
C

Cumulous

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?
 
S

Sue Mosher [MVP-Outlook]

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
 
C

Cumulous

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
 

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