Susan Harkins
ssharkins at gmail.com
Fri Oct 19 08:43:18 CDT 2007
The f ollowing code was used in an example that showed how to add command buttons to an Outlook toolbar. This procedure returns the number of items in the selected folder, using PickFolder. A reader is getting an error at & objFolder.Name _ Seems to have the right libraries referenced, and I'm clueless. Anyone had trouble with PickFolder -- I'm not convinced that's even the problem though. He sent a picture of the error, and I don't think there are any typos or anything -- he copied it straight from the article. Had other comments from readers saying it worked great, so I think this is something on his system. Outlook is hosed on my system, so I can't even play with it right now. Susan H. Sub GetItemCount() 'Return the number of messages in selected folder. 'The resulting count doesn't include subfolders. Dim ns As Outlook.NameSpace Dim objFolder As Outlook.MAPIFolder Dim intCount As Integer Dim strMessage As String Set ns = GetNamespace("MAPI") Set objFolder = ns.PickFolder intCount = objFolder.Items.Count strMessage = "The folder " _ & objFolder.Name _ & " has " _ & intCount _ & " item(s)." Debug.Print strMessage MsgBox strMessage, vbOKOnly, "Information" End Sub