Name/number of Current Folder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!

I wrote the following line in a macro:
Dim folderName As String
folderName = Application.ActiveExplorer.CurrentFolder

after running the line, I get the name of the Current Folder. I want the
number of the folder, because people use different langueges in outlook, and
the name "Inbox" or "Sent Items" is in different langueges by each user. How
can I get the number of the folder instead of the name?

Thanks,
Yonina.
 
Folders don't have numbers. What would you do with such a number if they did?

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

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Sounds like you're looking for a Guid of some sort for language-insensitive
comparison. Unfortunately, as Sue mentioned there isn't one.

What you can do is use the GetDefaultFolder() method of the Namespace and
compare the EntryID of the MAPIFolder that it returns. If you're using VBA
you may just be able to compare the object references, but I'm using C# and
they tend to return different instances on each call.

Dim ns As Namespace
Dim currentFolder As MAPIFolder
Dim sentFolder As MAPIFolder

Set ns = Application.GetNamespace("MAPI")
Set currentFolder = Application.ActiveExplorer().CurrentFolder
Set sentFolder = ns.GetDefaultFolder(olFolderSentMail)

If currentFolder.EntryID = sentFolder.EntryID Then
....
End If
 
Thank you all.

My problem was that names of the folders were sometimes in english and
sometimes in a different language. So I just put a nother condition in my
"if" and used "OR". That way the program recognizes the folder in both
languages.

Thank again,
Yonina.
 
That will of course break in another language or if MS ever changed the name
of the folder. The code I suggested is more resilient.
 
OK. I'll try you're code.

Josh Einstein said:
That will of course break in another language or if MS ever changed the name
of the folder. The code I suggested is more resilient.
 
Back
Top