Name/number of Current Folder

×

קובץ

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

Sue Mosher [MVP-Outlook]

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
 
J

Josh Einstein

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.
 
J

Josh Einstein

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.
 

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