Consulting

Results 1 to 2 of 2

Thread: Solved: extract body of the message

  1. #1
    VBAX Regular
    Joined
    Sep 2005
    Posts
    78
    Location

    Solved: extract body of the message

    I have a listview on a form, in that listview i am displaying to, subject and sentdate from outlook inbox.
    When i select any of the item from listbox i get the subject for the selected item by this code :

    objform.ListView1.SelectedItem.SubItems(1)
    But i also want body of the selected message. Note that i am not taking body in the listview. If i take body in listview it will be quite easy to get it(same as above code.) But, I dont want to show body in listview. Or is there any way that i can hide body column from listview.............. Or without adding it to listview can i get ody of the selected message?

    This code is for inbox
    Dim oinFolder As Object
    	Set oinFolder = oNameSpace.GetDefaultFolder(outlook.OlDefaultFolders.olFolderInbox)
    THis is the code for adding to listview
    For Each Inboxmail In oinFolder.Items
    		
    			 Dim j As Integer
    			 j = 1
    		
    			 With ListView1.ListItems
    			 .Add j, , Inboxmail.To
    			 End With
    	   
    			 With ListView1
    			 .ListItems(j).SubItems(1) = Inboxmail.subject
    			 End With
    	   
    			 With ListView1
    			 .ListItems(j).SubItems(2) = Inboxmail.SentOn
    			 End With
     
    			 'With ListView1
    			' .ListItems(j).SubItems(3) = Inboxmail.body
    			' End With
    			 j = j + 1
    		   
    		Next

  2. #2
    I'm unfamiliar with usign a listview control, but I imagine you could use the same tricks as with a listbox. If you can find a way to set the column widths in the display, you can include the message body as a 0"-width column.

    If that doesn't work, it appears each ListItem in a ListView has a Tag property. You can probably set the message body string to this property.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •