Results 1 to 8 of 8
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating Folders and Message Rules (2000)

    Im tyring to in VBA add a new folder to someones inbox and add a message rule for that folder.

    im not having much luck! has anyone got any snippets of code i could take a look at

    regards

    Chance

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Creating Folders and Message Rules (2000)

    VBA can add a folder but VBA cannot interoperate with the Rules Wizard. VBA has some events for detecting when new mail has arrived, but I haven't played with them enough to say whether you should bother using them as an alternative.

    To explore how you would add a folder, start in the online help with the MAPIFolder object, and search here for code samples involving those objects.

  3. #3
    5 Star Lounger
    Join Date
    Dec 2002
    Location
    Perth, Western Australia, Australia
    Posts
    730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Folders and Message Rules (2000)

    How did you manage this? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    <font face="Comic Sans MS" color="blue">TimOz</font>
    <img src=/S/flags/Finland.gif border=0 alt=Finland width=30 height=18> <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Creating Folders and Message Rules (2000)

    There were some behind the scenes changes going on and a Lounge file got munged. I saved the text of my post to a Notepad file and rebooted, thinking it was me. While I was at dinner, the Lounge was repaired and I was able to delete that disaster and post a new version. If you must know. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  5. #5
    5 Star Lounger
    Join Date
    Dec 2002
    Location
    Perth, Western Australia, Australia
    Posts
    730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Folders and Message Rules (2000)

    Looked like a severe case indigestion, so curiosity got the better of me! <img src=/S/wink.gif border=0 alt=wink width=15 height=15>
    <font face="Comic Sans MS" color="blue">TimOz</font>
    <img src=/S/flags/Finland.gif border=0 alt=Finland width=30 height=18> <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  6. #6
    Star Lounger
    Join Date
    Apr 2002
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Folders and Message Rules (2000)

    Ive got my code so far for adding the folders which is below, but is there anything ican do by any method to add rules to someones outlook ? Ive got a rollout to 90 users, who each need there rules changing so that nay message they get with the subject "CC425", "CC426" go to the respective folders created in the code below. easier i can make this on the user the more chance i have of getting ot the pub in time



    Private Sub CommandButton1_Click()
    Dim MyAs As Assistant
    Dim oloUtlook As Outlook.Application
    Dim ns As Outlook.NameSpace
    Dim itm As Object

    On Error Resume Next


    Application.ScreenUpdating = False

    Set oloUtlook = CreateObject("Outlook.Application")
    Set ns = oloUtlook.GetNamespace("MAPI")
    Set itm = ns.GetDefaultFolder(olFolderInbox)

    itm.Folders.Add ("CC425")
    itm.Folders.Add ("CC426")




    Set oloUtlook = Nothing
    Set ns = Nothing
    Set itm = Nothing

    MsgBox "Outlook Set Up Succesfully"
    ThisWorkbook.Close


    End Sub

  7. #7
    5 Star Lounger
    Join Date
    May 2001
    Location
    Washington, USA
    Posts
    750
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Folders and Message Rules (2000)

    Rules are not in the object model - in the reference materials I have anyway. I don't know if CDO or ExtendedMAPI can see them, but you might look there.

    I have a probably dumb idea, but it might work: Create the rule on one system and copy the rule file to the other systems. This assumes everyone has the same set of rules. Also assumes they all have the same profile name.

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Creating Folders and Message Rules (2000)

    Well, if you get desperate, you could try using SendKeys to zip through the dialogs and import the rule from a .RWZ file... no warranties on this suggestion!!

Posting Permissions

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