InBox is renamed to 0 (zero)

O

OssieMac

I have been using Excel VBA to program automated email messages and somehow
in a programming error I have managed to change the name of my Outlook InBox
to 0 (Zero). I have the VBA code working now and if I knew which code changed
it then I could probably reverse it with the same code but unfortunately I
don't.

Does anyone know how I can rename it back to InBox. Possibly a registry
tweek to allow the properties folder name field to be changed.
 
N

neo [mvp outlook]

What version of Microsoft Outlook are you using? The reason I ask is that
in Outlook 2007, you just have to start Outlook with the /resetfoldernames
command line switch. Earlier versions may require a different method to
resolve.


I have been using Excel VBA to program automated email messages and somehow
in a programming error I have managed to change the name of my Outlook InBox
to 0 (Zero). I have the VBA code working now and if I knew which code
changed
it then I could probably reverse it with the same code but unfortunately I
don't.

Does anyone know how I can rename it back to InBox. Possibly a registry
tweek to allow the properties folder name field to be changed.
 
O

OssieMac

Thank you for the response Neo.

I am using Outlook XP (2002). However, by going back through my versions of
code (Yes! I sometimes do "Save As" to a new version number each time I make
a code change) I have been able to find what I did wrong and have been able
to extract the incorrect code and use it to fix the my problem.

Everything now appears to be working as it should with the correct "Inbox"
name but I am still wondering if I have done anything that will cause
problems later. I am posting the code I used but feel free to condemn it if
you think that it can cause problems otherwise others on this forum could be
misled by it.

Sub RenameOutlookFolder()

'Used to rename the Inbox folder after accidently renaming it
'due to an error with Excel VBA code.

'Tested on Outlook XP (2002). Run from VBA in Excel XP (2002)
'but will probably work under VBA in other Office Applications.

'By using early binding (as per example) when dimensioning
'the variables the other GetDefaultFolder() parameters (for the
'other default folders) are displayed with the VBA intellisence
'when the opening parenthesis is typed.

'Note to use early binding:
'While in the VBA editor select Tools -> References
'and scroll down to Microsoft Outlook nn.0 Object Library
'where nn.0 is the version of Outlook (10.0 is XP or 2002)
'Ensure to check the box not just select the line.

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As Object

Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
objFolder.Name = "Inbox"

set objFolder = Nothing
set objNameSpace = Nothing
set objOutlook = Nothing

End Sub
 
N

neo [mvp outlook]

There is nothing wrong with renaming Inbox back to Inbox via code.
Something that has to be done in the older versions when something causes it
to get renamed. Other than that, I seem to remember a bug in earlier
versions where this would happen with calendar items, but for the life of
me, I can't remember the details.

Thank you for the response Neo.

I am using Outlook XP (2002). However, by going back through my versions of
code (Yes! I sometimes do "Save As" to a new version number each time I make
a code change) I have been able to find what I did wrong and have been able
to extract the incorrect code and use it to fix the my problem.

Everything now appears to be working as it should with the correct "Inbox"
name but I am still wondering if I have done anything that will cause
problems later. I am posting the code I used but feel free to condemn it if
you think that it can cause problems otherwise others on this forum could be
misled by it.

Sub RenameOutlookFolder()

'Used to rename the Inbox folder after accidently renaming it
'due to an error with Excel VBA code.

'Tested on Outlook XP (2002). Run from VBA in Excel XP (2002)
'but will probably work under VBA in other Office Applications.

'By using early binding (as per example) when dimensioning
'the variables the other GetDefaultFolder() parameters (for the
'other default folders) are displayed with the VBA intellisence
'when the opening parenthesis is typed.

'Note to use early binding:
'While in the VBA editor select Tools -> References
'and scroll down to Microsoft Outlook nn.0 Object Library
'where nn.0 is the version of Outlook (10.0 is XP or 2002)
'Ensure to check the box not just select the line.

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objFolder As Object

Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
objFolder.Name = "Inbox"

set objFolder = Nothing
set objNameSpace = Nothing
set objOutlook = Nothing

End Sub
 
O

OssieMac

Thanks for your help Neo.

I have a computer with xl2007 so your first answer is good info to have.
Also good info for anyone else searching the forum for answers.

Your last post makes me feel more comfortable about having used code to
rename the Inbox.

Thanks again,

OssieMac
 

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