help
-
hi.. i've used outlook automation to extract e-mails from our exchange server.. my problem is i can't think of any control that can hold the e-mails.. when i use a listbox, it takes like 10 mins to download the contents of my e-mail.. what control can u suggest so it will load faster? thanks.. here's my code: Dim ol As Outlook.Application Dim olns As Outlook.NameSpace Dim myRecipient, myfolder, numitems, myitems Dim i As Integer ol = New Outlook.Application olns = ol.GetNamespace("MAPI") myRecipient = olns.CreateRecipient("ITMC L2 DSS-ALERT HUB") myRecipient.Resolve() myfolder = olns.GetSharedDefaultFolder _ (myRecipient, Outlook.OlDefaultFolders.olFolderInbox) MsgBox("You have " & myfolder.items.count & " message", vbInformation) numitems = myfolder.Items.Count myitems = myfolder.Items For i = 1 To numitems ListBox1.Items.Add(myitems(i).subject) Next
-
hi.. i've used outlook automation to extract e-mails from our exchange server.. my problem is i can't think of any control that can hold the e-mails.. when i use a listbox, it takes like 10 mins to download the contents of my e-mail.. what control can u suggest so it will load faster? thanks.. here's my code: Dim ol As Outlook.Application Dim olns As Outlook.NameSpace Dim myRecipient, myfolder, numitems, myitems Dim i As Integer ol = New Outlook.Application olns = ol.GetNamespace("MAPI") myRecipient = olns.CreateRecipient("ITMC L2 DSS-ALERT HUB") myRecipient.Resolve() myfolder = olns.GetSharedDefaultFolder _ (myRecipient, Outlook.OlDefaultFolders.olFolderInbox) MsgBox("You have " & myfolder.items.count & " message", vbInformation) numitems = myfolder.Items.Count myitems = myfolder.Items For i = 1 To numitems ListBox1.Items.Add(myitems(i).subject) Next
-
hi.. i've used outlook automation to extract e-mails from our exchange server.. my problem is i can't think of any control that can hold the e-mails.. when i use a listbox, it takes like 10 mins to download the contents of my e-mail.. what control can u suggest so it will load faster? thanks.. here's my code: Dim ol As Outlook.Application Dim olns As Outlook.NameSpace Dim myRecipient, myfolder, numitems, myitems Dim i As Integer ol = New Outlook.Application olns = ol.GetNamespace("MAPI") myRecipient = olns.CreateRecipient("ITMC L2 DSS-ALERT HUB") myRecipient.Resolve() myfolder = olns.GetSharedDefaultFolder _ (myRecipient, Outlook.OlDefaultFolders.olFolderInbox) MsgBox("You have " & myfolder.items.count & " message", vbInformation) numitems = myfolder.Items.Count myitems = myfolder.Items For i = 1 To numitems ListBox1.Items.Add(myitems(i).subject) Next
That depends on what part of the code is taking so long and how many items your adding to the ListBox. If it's the part that's adding items to the
ListBox
, I noticed that you'r not preventing the control from redrawing itself every time you add an item to the control. You might want to scrap iterating through the items yourself and just use the.AddRange(Object())
method of theItems
property. I think something like this should work:ListBox1.DisplayMember = "Subject"
ListBox1.Items.AddRange( myItems )RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome