Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Select MailItem in Inbox Folder (Outlook 2000)

    HI,

    Just a Quikie. In Outlook 2007 I seem to be able to Define a single mails position in a folder by (where MyFolder is the the Folder and itm is the Mailitem) using:

    itm = MyFolder.Items(2)

    To designate the Correct Item to manipulate the Properties.

    However when I try to use the same code in 2000 it Dosn't Work??? Why??

    Also just to make sure What is the Path structure in 2000 to Designate say the: Inbox
    as this could be my problem, I supose

    Affectionatly yours
    Graliv

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select MailItem in Inbox Folder (Outlook 2000)

    To refer to the inbox:

    Dim nsp As NameSpace
    Dim fld As MAPIFolder
    Set nsp = Application.GetNameSpace("MAPI")
    Set fld = nsp.GetDefaultFolder(olFolderInbox)

  3. #3
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Select MailItem in Inbox Folder (Outlook 2000)

    And that Will work in Outlook 2000???

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select MailItem in Inbox Folder (Outlook 2000)

    Yes, it should. It worked in Outlook 98, if I remember correctly.

  5. #5
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Select MailItem in Inbox Folder (Outlook 2000)

    Hans:

    OK I seem to be getting a result but when I apply it to (dim itm as Mailitem) I get an error message " Object Variable or with block variable not set"???

    If I hover over the itm=Myfolder.Items(2) I get the correct Subject Line indicated??

    TX

  6. #6
    2 Star Lounger
    Join Date
    Mar 2007
    Location
    Wikltshire UK
    Posts
    152
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Select MailItem in Inbox Folder (Outlook 2000)

    Ooops I should:
    Set itm = Myfolder.Items(2)

    OK Sorted

    Thanks Hansv

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select MailItem in Inbox Folder (Outlook 2000)

    I used fld as variable name just as an example. You should either use MyFolder instead of fld in the code I posted:

    Dim MyFolder As MAPIFolder
    ...
    Set MyFolder = nsp.GetDefaultFolder(olFolderInbox)
    Set itm = MyFolder.Items(2)

    or use fld in your own code:

    Dim fld As MAPIFolder
    ...
    Set fld = nsp.GetDefaultFolder(olFolderInbox)
    Set itm = fld.Items(2)

Posting Permissions

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