Macros and Outlook?

Discussion in 'Computer Security' started by BruceJ, Oct 28, 2003.

  1. BruceJ

    BruceJ Guest

    Is there a way to "Record a macro" in OL 2002? I want to create rules via VB
    (and it looks like you can not do this reliabley in OL 2002), so my next
    option is to do a MACRO. Can I create a macro (that launches in excel
    ideally!) to modify an existing rule?

    Thanks
    Bruce
     
    BruceJ, Oct 28, 2003
    #1
    1. Advertising

  2. You can't record a macro in Outlook, but you can write them. While it is possible (not at all easy) to make some modifications of very simple rules, my guess is that your project (as yet undescribed) will need more than just simple rules. See http://www.slipstick.com/dev/vb.htm for VB+Outlook resources, including samples.
    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx


    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message news:Dfznb.50357$Fm2.25585@attbi_s04...
    > Is there a way to "Record a macro" in OL 2002? I want to create rules via VB
    > (and it looks like you can not do this reliabley in OL 2002), so my next
    > option is to do a MACRO. Can I create a macro (that launches in excel
    > ideally!) to modify an existing rule?
    >
    > Thanks
    > Bruce
    >
    >
     
    Sue Mosher [MVP], Oct 31, 2003
    #2
    1. Advertising

  3. BruceJ

    BruceJ Guest

    Sue,

    Do you know of any samples that will look at email as it comes in, and then
    match it to a list of given addresses, and then move it to a folder?

    Is there a way to look at the code for any of the rules that I have created?
    I am used to being able to "record" a macro and then modify it in Excel, and
    I am just looking for the basic info I need.

    Thanks
    Bruce



    "Sue Mosher [MVP]" <> wrote in message
    news:...
    You can't record a macro in Outlook, but you can write them. While it is
    possible (not at all easy) to make some modifications of very simple rules,
    my guess is that your project (as yet undescribed) will need more than just
    simple rules. See http://www.slipstick.com/dev/vb.htm for VB+Outlook
    resources, including samples.
    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx


    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:Dfznb.50357$Fm2.25585@attbi_s04...
    > Is there a way to "Record a macro" in OL 2002? I want to create rules via

    VB
    > (and it looks like you can not do this reliabley in OL 2002), so my next
    > option is to do a MACRO. Can I create a macro (that launches in excel
    > ideally!) to modify an existing rule?
    >
    > Thanks
    > Bruce
    >
    >
     
    BruceJ, Oct 31, 2003
    #3
  4. See http://www.slipstick.com/dev/code/quarexe.htm for a simple example of watching for new Inbox items and moving some to a new folder. Your variation would involve looking at addresses. If you mean the From address, see http://www.slipstick.com/dev/code/getsenderaddy.htm.

    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message news:Adwob.69826$HS4.625205@attbi_s01...
    >
    > Do you know of any samples that will look at email as it comes in, and then
    > match it to a list of given addresses, and then move it to a folder?
     
    Sue Mosher [MVP], Oct 31, 2003
    #4
  5. BruceJ

    BruceJ Guest

    Sue, after spending more time on your site, I came across something that
    sounded _VERY_ much workable to me! That is a RULE with "Sender is in
    SPECIFIED Address Book".

    This LOOKS like it is just what I would need....

    If I can get THIS to work, then all I need to do is to update the contact
    with then new info when I am looking for emails. Hopefully I can figure out
    how to do this with VBA!!!


    Thanks
    Bruce



    "Sue Mosher [MVP]" <> wrote in message
    news:%...
    See http://www.slipstick.com/dev/code/quarexe.htm for a simple example of
    watching for new Inbox items and moving some to a new folder. Your variation
    would involve looking at addresses. If you mean the From address, see
    http://www.slipstick.com/dev/code/getsenderaddy.htm.

    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:Adwob.69826$HS4.625205@attbi_s01...
    >
    > Do you know of any samples that will look at email as it comes in, and

    then
    > match it to a list of given addresses, and then move it to a folder?
     
    BruceJ, Nov 1, 2003
    #5
  6. Great, Bruce. You might find this code useful, too: http://www.slipstick.com/contacts/addauto.htm

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message news:eek:2Uob.80019$e01.263179@attbi_s02...
    > Sue, after spending more time on your site, I came across something that
    > sounded _VERY_ much workable to me! That is a RULE with "Sender is in
    > SPECIFIED Address Book".
    >
    > This LOOKS like it is just what I would need....
    >
    > If I can get THIS to work, then all I need to do is to update the contact
    > with then new info when I am looking for emails. Hopefully I can figure out
    > how to do this with VBA!!!
    >
    >
    > Thanks
    > Bruce
    >
    >
    >
    > "Sue Mosher [MVP]" <> wrote in message
    > news:%...
    > See http://www.slipstick.com/dev/code/quarexe.htm for a simple example of
    > watching for new Inbox items and moving some to a new folder. Your variation
    > would involve looking at addresses. If you mean the From address, see
    > http://www.slipstick.com/dev/code/getsenderaddy.htm.
    >
    > --
    > Sue Mosher, Outlook MVP
    > Outlook and Exchange solutions at http://www.slipstick.com
    > Author of
    > Microsoft Outlook Programming: Jumpstart
    > for Administrators, Power Users, and Developers
    > http://www.outlookcode.com/jumpstart.aspx
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:Adwob.69826$HS4.625205@attbi_s01...
    > >
    > > Do you know of any samples that will look at email as it comes in, and

    > then
    > > match it to a list of given addresses, and then move it to a folder?

    >
    >
     
    Sue Mosher [MVP], Nov 1, 2003
    #6
  7. BruceJ

    BruceJ Guest

    Sue,

    Thanks for the link!
    I tried the code, but, it did not work....
    I even put a msgbox inthe code so I could see if it was getting to the code.
    It is not. I did put it in the correct folder, as per the instructions.

    Right now, my outlook is REALLLLLLLLYYYYYYY SLOWWWWW so I can not get there
    to pull out the code I put in. (I am cleaning out my pst file right now, and
    then going to run scanpst. I do have lots of JUNK and VIRUS emails. I need
    to purge those out and get my PST file smaller. It is currentlly over 1 g,
    and I need to watch out. Does 2002 still have the issue with 1.2 (I think
    that was the right size) files cuasing data to get lost and not being able
    to access your data? I think I am up to the current patches. This maybe
    should be a seperate email....


    Back to the origianal issue...

    Now, is there a way, I can do something similar from EXCEL? I use the VBA to
    send out all of the email I am actually looking for. All of the email I send
    out of OL, I don't need to put into the fold, as I do not need to follow
    their email perse. Or does it need to be called from Outlook?






    "Sue Mosher [MVP]" <> wrote in message
    news:...
    Great, Bruce. You might find this code useful, too:
    http://www.slipstick.com/contacts/addauto.htm

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:eek:2Uob.80019$e01.263179@attbi_s02...
    > Sue, after spending more time on your site, I came across something that
    > sounded _VERY_ much workable to me! That is a RULE with "Sender is in
    > SPECIFIED Address Book".
    >
    > This LOOKS like it is just what I would need....
    >
    > If I can get THIS to work, then all I need to do is to update the contact
    > with then new info when I am looking for emails. Hopefully I can figure

    out
    > how to do this with VBA!!!
    >
    >
    > Thanks
    > Bruce
    >
    >
    >
    > "Sue Mosher [MVP]" <> wrote in message
    > news:%...
    > See http://www.slipstick.com/dev/code/quarexe.htm for a simple example of
    > watching for new Inbox items and moving some to a new folder. Your

    variation
    > would involve looking at addresses. If you mean the From address, see
    > http://www.slipstick.com/dev/code/getsenderaddy.htm.
    >
    > --
    > Sue Mosher, Outlook MVP
    > Outlook and Exchange solutions at http://www.slipstick.com
    > Author of
    > Microsoft Outlook Programming: Jumpstart
    > for Administrators, Power Users, and Developers
    > http://www.outlookcode.com/jumpstart.aspx
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:Adwob.69826$HS4.625205@attbi_s01...
    > >
    > > Do you know of any samples that will look at email as it comes in, and

    > then
    > > match it to a list of given addresses, and then move it to a folder?

    >
    >
     
    BruceJ, Nov 6, 2003
    #7
  8. Outlook 2003 adds a new format for PST files that allows them to be nearly unlimited in size.
    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message news:M3vqb.128842$HS4.1023070@attbi_s01...
    >
    > Right now, my outlook is REALLLLLLLLYYYYYYY SLOWWWWW so I can not get there
    > to pull out the code I put in. (I am cleaning out my pst file right now, and
    > then going to run scanpst. I do have lots of JUNK and VIRUS emails. I need
    > to purge those out and get my PST file smaller. It is currentlly over 1 g,
    > and I need to watch out. Does 2002 still have the issue with 1.2 (I think
    > that was the right size) files cuasing data to get lost and not being able
    > to access your data? I think I am up to the current patches. This maybe
    > should be a seperate email....
     
    Sue Mosher [MVP], Nov 6, 2003
    #8
  9. Did you check your macro security settings -- Tools | Macro | Security? Does other VBA code run?

    If you're using Excel to send out the mail, then you should be able to adapt the code I provided to add the same functionality (checking addresses and creating contacts) to your Excel routines.
    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message news:M3vqb.128842$HS4.1023070@attbi_s01...
    >
    > Thanks for the link!
    > I tried the code, but, it did not work....
    > I even put a msgbox inthe code so I could see if it was getting to the code.
    > It is not. I did put it in the correct folder, as per the instructions.
    >
    > Back to the origianal issue...
    >
    > Now, is there a way, I can do something similar from EXCEL? I use the VBA to
    > send out all of the email I am actually looking for. All of the email I send
    > out of OL, I don't need to put into the fold, as I do not need to follow
    > their email perse. Or does it need to be called from Outlook?
    >
    > "Sue Mosher [MVP]" <> wrote in message
    > news:...
    > Great, Bruce. You might find this code useful, too:
    > http://www.slipstick.com/contacts/addauto.htm
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:eek:2Uob.80019$e01.263179@attbi_s02...
    > > Sue, after spending more time on your site, I came across something that
    > > sounded _VERY_ much workable to me! That is a RULE with "Sender is in
    > > SPECIFIED Address Book".
    > >
    > > This LOOKS like it is just what I would need....
    > >
    > > If I can get THIS to work, then all I need to do is to update the contact
    > > with then new info when I am looking for emails. Hopefully I can figure

    > out
    > > how to do this with VBA!!!
     
    Sue Mosher [MVP], Nov 6, 2003
    #9
  10. BruceJ

    BruceJ Guest

    I D/L redemption, and installed it. I then tried to register it in VB (I
    have 2 entries for SafeOutlookLibrary and both point to redemption.dll) When
    I restarted OL 2002, I got an error that it could not find extend.dat (or
    extra.dat if I look in event log. I THOUGHT it said extend.dat ) (I cleared
    the message, as I thought I would be able to get it again by restarting O/L-
    I have not been able to get the error again….)

    I have pressed ALT-11, starting the VBA editor, and then browsed to
    ThisOutlookSession and pasted the whole code section there. I have since
    moved all but the first section into a diff module.

    I then tried to run it by creating a new email to a address that was not in
    the contacts folder. I did not get any response. I then put a msgbox in the
    code, expecting it to pop the message box, it did not. I am NOT familiar
    with O/L for VBA, but I have done some in EXCEL, so it SHOULD be similair…



    What am I missing?



    Also, how whould I change the contact address book to work with? Would I
    change the line

    Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items

    To something like Set colContacts = “NewAddressBook”





    Thanks for taking the time to read and to respond to this.



    I have not tried any other VBA code. I have not had any need for it. what
    would be a good one to just test something?

    I have signed the code with selfcert and I have also put security to LOW.



    Thanks

    Bruce





    "Sue Mosher [MVP]" <> wrote in message
    news:...
    Did you check your macro security settings -- Tools | Macro | Security? Does
    other VBA code run?

    If you're using Excel to send out the mail, then you should be able to adapt
    the code I provided to add the same functionality (checking addresses and
    creating contacts) to your Excel routines.
    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:M3vqb.128842$HS4.1023070@attbi_s01...
    >
    > Thanks for the link!
    > I tried the code, but, it did not work....
    > I even put a msgbox inthe code so I could see if it was getting to the

    code.
    > It is not. I did put it in the correct folder, as per the instructions.
    >
    > Back to the origianal issue...
    >
    > Now, is there a way, I can do something similar from EXCEL? I use the VBA

    to
    > send out all of the email I am actually looking for. All of the email I

    send
    > out of OL, I don't need to put into the fold, as I do not need to follow
    > their email perse. Or does it need to be called from Outlook?
    >
    > "Sue Mosher [MVP]" <> wrote in message
    > news:...
    > Great, Bruce. You might find this code useful, too:
    > http://www.slipstick.com/contacts/addauto.htm
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:eek:2Uob.80019$e01.263179@attbi_s02...
    > > Sue, after spending more time on your site, I came across something that
    > > sounded _VERY_ much workable to me! That is a RULE with "Sender is in
    > > SPECIFIED Address Book".
    > >
    > > This LOOKS like it is just what I would need....
    > >
    > > If I can get THIS to work, then all I need to do is to update the

    contact
    > > with then new info when I am looking for emails. Hopefully I can figure

    > out
    > > how to do this with VBA!!!
     
    BruceJ, Nov 6, 2003
    #10
  11. Did you restart Outlook after changing the macro security setting to Low? If so, does any other VBA code run? Write a "hello world" MsgBox routine if you need something to test. Did you try putting a breakpoint in the Application_ ItemSend() event handler?

    You can make a basic check of whether there's a problem with Redemption by looking at Tools | Options | Other | Advanced Options | Addin Manager. It should appear there.

    > Also, how whould I change the contact address book to work with? Would I
    > change the line
    >
    > Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    >
    > To something like Set colContacts = “NewAddressBook”


    Contacts folders and address books are *not* the same thing, so I'm not sure what you're getting at.
    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message news:e2yqb.92080$mZ5.603450@attbi_s54...
    > I D/L redemption, and installed it. I then tried to register it in VB (I
    > have 2 entries for SafeOutlookLibrary and both point to redemption.dll) When
    > I restarted OL 2002, I got an error that it could not find extend.dat (or
    > extra.dat if I look in event log. I THOUGHT it said extend.dat ) (I cleared
    > the message, as I thought I would be able to get it again by restarting O/L-
    > I have not been able to get the error again….)
    >
    > I have pressed ALT-11, starting the VBA editor, and then browsed to
    > ThisOutlookSession and pasted the whole code section there. I have since
    > moved all but the first section into a diff module.
    >
    > I then tried to run it by creating a new email to a address that was not in
    > the contacts folder. I did not get any response. I then put a msgbox in the
    > code, expecting it to pop the message box, it did not. I am NOT familiar
    > with O/L for VBA, but I have done some in EXCEL, so it SHOULD be similair…
    >
    > I have not tried any other VBA code. I have not had any need for it. what
    > would be a good one to just test something?
    >
    > I have signed the code with selfcert and I have also put security to LOW.
    >
    > "Sue Mosher [MVP]" <> wrote in message
    > news:...
    > Did you check your macro security settings -- Tools | Macro | Security? Does
    > other VBA code run?
    >
    > If you're using Excel to send out the mail, then you should be able to adapt
    > the code I provided to add the same functionality (checking addresses and
    > creating contacts) to your Excel routines.
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:M3vqb.128842$HS4.1023070@attbi_s01...
    > >
    > > Thanks for the link!
    > > I tried the code, but, it did not work....
    > > I even put a msgbox inthe code so I could see if it was getting to the

    > code.
    > > It is not. I did put it in the correct folder, as per the instructions.
    > >
    > > Back to the origianal issue...
    > >
    > > Now, is there a way, I can do something similar from EXCEL? I use the VBA

    > to
    > > send out all of the email I am actually looking for. All of the email I

    > send
    > > out of OL, I don't need to put into the fold, as I do not need to follow
    > > their email perse. Or does it need to be called from Outlook?
    > >
    > > "Sue Mosher [MVP]" <> wrote in message
    > > news:...
    > > Great, Bruce. You might find this code useful, too:
    > > http://www.slipstick.com/contacts/addauto.htm
     
    Sue Mosher [MVP], Nov 6, 2003
    #11
  12. BruceJ

    BruceJ Guest

    Did you restart Outlook after changing the macro security setting to Low?
    >I thought I did... I did restart again and my Hello World worked.

    Now I am getting
    run-time error '424':
    Object required
    and debug puts me at
    For Each objSRecip In objSMail.Recipients
    objSMail.Recipients = nothing when I place my mouse over it.

    Thanks
    Bruce


    "Sue Mosher [MVP]" <> wrote in message
    news:...
    Did you restart Outlook after changing the macro security setting to Low? If
    so, does any other VBA code run? Write a "hello world" MsgBox routine if you
    need something to test. Did you try putting a breakpoint in the Application_
    ItemSend() event handler?

    You can make a basic check of whether there's a problem with Redemption by
    looking at Tools | Options | Other | Advanced Options | Addin Manager. It
    should appear there.

    > Also, how whould I change the contact address book to work with? Would I
    > change the line
    >
    > Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    >
    > To something like Set colContacts = “NewAddressBook”


    Contacts folders and address books are *not* the same thing, so I'm not sure
    what you're getting at.
    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:e2yqb.92080$mZ5.603450@attbi_s54...
    > I D/L redemption, and installed it. I then tried to register it in VB (I
    > have 2 entries for SafeOutlookLibrary and both point to redemption.dll)

    When
    > I restarted OL 2002, I got an error that it could not find extend.dat (or
    > extra.dat if I look in event log. I THOUGHT it said extend.dat ) (I

    cleared
    > the message, as I thought I would be able to get it again by restarting

    O/L-
    > I have not been able to get the error again….)
    >
    > I have pressed ALT-11, starting the VBA editor, and then browsed to
    > ThisOutlookSession and pasted the whole code section there. I have since
    > moved all but the first section into a diff module.
    >
    > I then tried to run it by creating a new email to a address that was not

    in
    > the contacts folder. I did not get any response. I then put a msgbox in

    the
    > code, expecting it to pop the message box, it did not. I am NOT familiar
    > with O/L for VBA, but I have done some in EXCEL, so it SHOULD be similair…
    >
    > I have not tried any other VBA code. I have not had any need for it. what
    > would be a good one to just test something?
    >
    > I have signed the code with selfcert and I have also put security to LOW.
    >
    > "Sue Mosher [MVP]" <> wrote in message
    > news:...
    > Did you check your macro security settings -- Tools | Macro | Security?

    Does
    > other VBA code run?
    >
    > If you're using Excel to send out the mail, then you should be able to

    adapt
    > the code I provided to add the same functionality (checking addresses and
    > creating contacts) to your Excel routines.
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:M3vqb.128842$HS4.1023070@attbi_s01...
    > >
    > > Thanks for the link!
    > > I tried the code, but, it did not work....
    > > I even put a msgbox inthe code so I could see if it was getting to the

    > code.
    > > It is not. I did put it in the correct folder, as per the instructions.
    > >
    > > Back to the origianal issue...
    > >
    > > Now, is there a way, I can do something similar from EXCEL? I use the

    VBA
    > to
    > > send out all of the email I am actually looking for. All of the email I

    > send
    > > out of OL, I don't need to put into the fold, as I do not need to follow
    > > their email perse. Or does it need to be called from Outlook?
    > >
    > > "Sue Mosher [MVP]" <> wrote in message
    > > news:...
    > > Great, Bruce. You might find this code useful, too:
    > > http://www.slipstick.com/contacts/addauto.htm
     
    BruceJ, Nov 6, 2003
    #12
  13. BruceJ

    BruceJ Guest

    Sorry to be a pest <grin>

    If I wanted it to add the contact info into a diff folder, would I change
    the
    Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    to
    Set colContacts = "MyContactFolderNameHere"
    If not, how would I cahnge the folder?
    thanks

    Bruce

    "Sue Mosher [MVP]" <> wrote in message
    news:...
    Did you restart Outlook after changing the macro security setting to Low? If
    so, does any other VBA code run? Write a "hello world" MsgBox routine if you
    need something to test. Did you try putting a breakpoint in the Application_
    ItemSend() event handler?

    You can make a basic check of whether there's a problem with Redemption by
    looking at Tools | Options | Other | Advanced Options | Addin Manager. It
    should appear there.

    > Also, how whould I change the contact address book to work with? Would I
    > change the line
    >
    > Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    >
    > To something like Set colContacts = “NewAddressBook”


    Contacts folders and address books are *not* the same thing, so I'm not sure
    what you're getting at.
    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:e2yqb.92080$mZ5.603450@attbi_s54...
    > I D/L redemption, and installed it. I then tried to register it in VB (I
    > have 2 entries for SafeOutlookLibrary and both point to redemption.dll)

    When
    > I restarted OL 2002, I got an error that it could not find extend.dat (or
    > extra.dat if I look in event log. I THOUGHT it said extend.dat ) (I

    cleared
    > the message, as I thought I would be able to get it again by restarting

    O/L-
    > I have not been able to get the error again….)
    >
    > I have pressed ALT-11, starting the VBA editor, and then browsed to
    > ThisOutlookSession and pasted the whole code section there. I have since
    > moved all but the first section into a diff module.
    >
    > I then tried to run it by creating a new email to a address that was not

    in
    > the contacts folder. I did not get any response. I then put a msgbox in

    the
    > code, expecting it to pop the message box, it did not. I am NOT familiar
    > with O/L for VBA, but I have done some in EXCEL, so it SHOULD be similair…
    >
    > I have not tried any other VBA code. I have not had any need for it. what
    > would be a good one to just test something?
    >
    > I have signed the code with selfcert and I have also put security to LOW.
    >
    > "Sue Mosher [MVP]" <> wrote in message
    > news:...
    > Did you check your macro security settings -- Tools | Macro | Security?

    Does
    > other VBA code run?
    >
    > If you're using Excel to send out the mail, then you should be able to

    adapt
    > the code I provided to add the same functionality (checking addresses and
    > creating contacts) to your Excel routines.
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:M3vqb.128842$HS4.1023070@attbi_s01...
    > >
    > > Thanks for the link!
    > > I tried the code, but, it did not work....
    > > I even put a msgbox inthe code so I could see if it was getting to the

    > code.
    > > It is not. I did put it in the correct folder, as per the instructions.
    > >
    > > Back to the origianal issue...
    > >
    > > Now, is there a way, I can do something similar from EXCEL? I use the

    VBA
    > to
    > > send out all of the email I am actually looking for. All of the email I

    > send
    > > out of OL, I don't need to put into the fold, as I do not need to follow
    > > their email perse. Or does it need to be called from Outlook?
    > >
    > > "Sue Mosher [MVP]" <> wrote in message
    > > news:...
    > > Great, Bruce. You might find this code useful, too:
    > > http://www.slipstick.com/contacts/addauto.htm
     
    BruceJ, Nov 6, 2003
    #13
  14. What statement instantiates objSMail?

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message news:Hfzqb.94247$275.262182@attbi_s53...
    > Did you restart Outlook after changing the macro security setting to Low?
    > >I thought I did... I did restart again and my Hello World worked.

    > Now I am getting
    > run-time error '424':
    > Object required
    > and debug puts me at
    > For Each objSRecip In objSMail.Recipients
    > objSMail.Recipients = nothing when I place my mouse over it.
    >
    > Thanks
    > Bruce
    >
    >
    > "Sue Mosher [MVP]" <> wrote in message
    > news:...
    > Did you restart Outlook after changing the macro security setting to Low? If
    > so, does any other VBA code run? Write a "hello world" MsgBox routine if you
    > need something to test. Did you try putting a breakpoint in the Application_
    > ItemSend() event handler?
    >
    > You can make a basic check of whether there's a problem with Redemption by
    > looking at Tools | Options | Other | Advanced Options | Addin Manager. It
    > should appear there.
    >
    > > Also, how whould I change the contact address book to work with? Would I
    > > change the line
    > >
    > > Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    > >
    > > To something like Set colContacts = “NewAddressBook”

    >
    > Contacts folders and address books are *not* the same thing, so I'm not sure
    > what you're getting at.
    > --
    > Sue Mosher, Outlook MVP
    > Outlook and Exchange solutions at http://www.slipstick.com
    > Author of
    > Microsoft Outlook Programming: Jumpstart
    > for Administrators, Power Users, and Developers
    > http://www.outlookcode.com/jumpstart.aspx
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:e2yqb.92080$mZ5.603450@attbi_s54...
    > > I D/L redemption, and installed it. I then tried to register it in VB (I
    > > have 2 entries for SafeOutlookLibrary and both point to redemption.dll)

    > When
    > > I restarted OL 2002, I got an error that it could not find extend.dat (or
    > > extra.dat if I look in event log. I THOUGHT it said extend.dat ) (I

    > cleared
    > > the message, as I thought I would be able to get it again by restarting

    > O/L-
    > > I have not been able to get the error again….)
    > >
    > > I have pressed ALT-11, starting the VBA editor, and then browsed to
    > > ThisOutlookSession and pasted the whole code section there. I have since
    > > moved all but the first section into a diff module.
    > >
    > > I then tried to run it by creating a new email to a address that was not

    > in
    > > the contacts folder. I did not get any response. I then put a msgbox in

    > the
    > > code, expecting it to pop the message box, it did not. I am NOT familiar
    > > with O/L for VBA, but I have done some in EXCEL, so it SHOULD be similair…
    > >
    > > I have not tried any other VBA code. I have not had any need for it. what
    > > would be a good one to just test something?
    > >
    > > I have signed the code with selfcert and I have also put security to LOW.
    > >
    > > "Sue Mosher [MVP]" <> wrote in message
    > > news:...
    > > Did you check your macro security settings -- Tools | Macro | Security?

    > Does
    > > other VBA code run?
    > >
    > > If you're using Excel to send out the mail, then you should be able to

    > adapt
    > > the code I provided to add the same functionality (checking addresses and
    > > creating contacts) to your Excel routines.
    > >
    > > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > > news:M3vqb.128842$HS4.1023070@attbi_s01...
    > > >
    > > > Thanks for the link!
    > > > I tried the code, but, it did not work....
    > > > I even put a msgbox inthe code so I could see if it was getting to the

    > > code.
    > > > It is not. I did put it in the correct folder, as per the instructions.
    > > >
    > > > Back to the origianal issue...
    > > >
    > > > Now, is there a way, I can do something similar from EXCEL? I use the

    > VBA
    > > to
    > > > send out all of the email I am actually looking for. All of the email I

    > > send
    > > > out of OL, I don't need to put into the fold, as I do not need to follow
    > > > their email perse. Or does it need to be called from Outlook?
    > > >
    > > > "Sue Mosher [MVP]" <> wrote in message
    > > > news:...
    > > > Great, Bruce. You might find this code useful, too:
    > > > http://www.slipstick.com/contacts/addauto.htm

    >
    >
     
    Sue Mosher [MVP], Nov 6, 2003
    #14
  15. To get a non-default folder, you need to walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.slipstick.com/dev/code/getfolder.htm

    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message news:Oqzqb.95807$9E1.459957@attbi_s52...
    > Sorry to be a pest <grin>
    >
    > If I wanted it to add the contact info into a diff folder, would I change
    > the
    > Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    > to
    > Set colContacts = "MyContactFolderNameHere"
    > If not, how would I cahnge the folder?
    > thanks
    >
     
    Sue Mosher [MVP], Nov 6, 2003
    #15
  16. BruceJ

    BruceJ Guest

    Here is the code I have (as you an see, just cut and paste now (I took out
    my msgbox)
    Redemtion.dll is present, Outlook DOES have it in the add-in manager.

    Thanks
    Bruce

    ' sample application by Sue Mosher
    ' send questions/comments to

    ' The Application_ItemSend procedure must go in the
    ' built-in ThisOutlookSession session module in Outlook VBA
    Private Sub Application_ItemSend(ByVal Item As Object, _
    Cancel As Boolean)
    Item.Categories = ""
    If Item.Class = olMail Then
    Call AddRecipToContacts(Item)
    End If
    End Sub

    ' This procedure can go in any module
    Sub AddRecipToContacts(objMail As MailItem)
    Dim strFind As String
    Dim strAddress As String
    Dim objSMail As Redemption.SafeMailItem
    Dim objSRecip As Redemption.SafeRecipient
    Dim objNS As NameSpace
    Dim colContacts As Items
    Dim objContact As ContactItem
    Dim i As Integer

    ' process message recipients
    Set objSMail = CreateObject("Redemption.SafeMailItem")
    objMail.Save
    objSMail.Item = objMail
    Set objNS = Application.GetNamespace("MAPI")
    Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    For Each objSRecip In objSMail.Recipients
    ' check to see if the recip is already in Contacts
    strAddress = objSRecip.Address
    For i = 1 To 3
    strFind = "[Email" & i & "Address] = " & _
    AddQuote(strAddress)
    Set objContact = colContacts.Find(strFind)
    If Not objContact Is Nothing Then
    Exit For
    End If
    Next

    ' if not, add it
    If objContact Is Nothing Then
    Set objContact = Application.CreateItem(olContactItem)
    With objContact
    .FullName = objSRecip.Name
    .Email1Address = strAddress
    .Save
    End With
    End If
    Set objContact = Nothing
    Next

    Set objSMail = Nothing
    Set objSRecip = Nothing
    Set objNS = Nothing
    Set colContacts = Nothing
    End Sub

    ' helper function - put in any module
    Function AddQuote(MyText) As String
    AddQuote = Chr(34) & MyText & Chr(34)
    End Function


    "Sue Mosher [MVP]" <> wrote in message
    news:...
    What statement instantiates objSMail?

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:Hfzqb.94247$275.262182@attbi_s53...
    > Did you restart Outlook after changing the macro security setting to Low?
    > >I thought I did... I did restart again and my Hello World worked.

    > Now I am getting
    > run-time error '424':
    > Object required
    > and debug puts me at
    > For Each objSRecip In objSMail.Recipients
    > objSMail.Recipients = nothing when I place my mouse over it.
    >
    > Thanks
    > Bruce
    >
    >
    > "Sue Mosher [MVP]" <> wrote in message
    > news:...
    > Did you restart Outlook after changing the macro security setting to Low?

    If
    > so, does any other VBA code run? Write a "hello world" MsgBox routine if

    you
    > need something to test. Did you try putting a breakpoint in the

    Application_
    > ItemSend() event handler?
    >
    > You can make a basic check of whether there's a problem with Redemption by
    > looking at Tools | Options | Other | Advanced Options | Addin Manager. It
    > should appear there.
    >
    > > Also, how whould I change the contact address book to work with? Would I
    > > change the line
    > >
    > > Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    > >
    > > To something like Set colContacts = “NewAddressBook”

    >
    > Contacts folders and address books are *not* the same thing, so I'm not

    sure
    > what you're getting at.
    > --
    > Sue Mosher, Outlook MVP
    > Outlook and Exchange solutions at http://www.slipstick.com
    > Author of
    > Microsoft Outlook Programming: Jumpstart
    > for Administrators, Power Users, and Developers
    > http://www.outlookcode.com/jumpstart.aspx
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:e2yqb.92080$mZ5.603450@attbi_s54...
    > > I D/L redemption, and installed it. I then tried to register it in VB (I
    > > have 2 entries for SafeOutlookLibrary and both point to redemption.dll)

    > When
    > > I restarted OL 2002, I got an error that it could not find extend.dat

    (or
    > > extra.dat if I look in event log. I THOUGHT it said extend.dat ) (I

    > cleared
    > > the message, as I thought I would be able to get it again by restarting

    > O/L-
    > > I have not been able to get the error again….)
    > >
    > > I have pressed ALT-11, starting the VBA editor, and then browsed to
    > > ThisOutlookSession and pasted the whole code section there. I have since
    > > moved all but the first section into a diff module.
    > >
    > > I then tried to run it by creating a new email to a address that was not

    > in
    > > the contacts folder. I did not get any response. I then put a msgbox in

    > the
    > > code, expecting it to pop the message box, it did not. I am NOT familiar
    > > with O/L for VBA, but I have done some in EXCEL, so it SHOULD be

    similair…
    > >
    > > I have not tried any other VBA code. I have not had any need for it.

    what
    > > would be a good one to just test something?
    > >
    > > I have signed the code with selfcert and I have also put security to

    LOW.
    > >
    > > "Sue Mosher [MVP]" <> wrote in message
    > > news:...
    > > Did you check your macro security settings -- Tools | Macro | Security?

    > Does
    > > other VBA code run?
    > >
    > > If you're using Excel to send out the mail, then you should be able to

    > adapt
    > > the code I provided to add the same functionality (checking addresses

    and
    > > creating contacts) to your Excel routines.
    > >
    > > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > > news:M3vqb.128842$HS4.1023070@attbi_s01...
    > > >
    > > > Thanks for the link!
    > > > I tried the code, but, it did not work....
    > > > I even put a msgbox inthe code so I could see if it was getting to the

    > > code.
    > > > It is not. I did put it in the correct folder, as per the

    instructions.
    > > >
    > > > Back to the origianal issue...
    > > >
    > > > Now, is there a way, I can do something similar from EXCEL? I use the

    > VBA
    > > to
    > > > send out all of the email I am actually looking for. All of the email

    I
    > > send
    > > > out of OL, I don't need to put into the fold, as I do not need to

    follow
    > > > their email perse. Or does it need to be called from Outlook?
    > > >
    > > > "Sue Mosher [MVP]" <> wrote in message
    > > > news:...
    > > > Great, Bruce. You might find this code useful, too:
    > > > http://www.slipstick.com/contacts/addauto.htm

    >
    >
     
    BruceJ, Nov 6, 2003
    #16
  17. BruceJ

    BruceJ Guest

    Sue,
    Am I doing this correctly? How would I use the getfolder() within the
    function AddRecipToContacts to set the desired contact folder (it is on the
    root of my Personal Folders) so I thought it should be "personal
    folders/BPConstacts"

    ' Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    Set colContacts = GetFolder("Personal Folders\BPContacts").Items
    I get an error13 Type mismatch

    If I do
    Set colContacts = GetFolder("BPContacts").Items
    I get a run time error 91 object varible or With block varible not set

    I am doing this wrong? I must be...

    Thanks
    Bruce




    "Sue Mosher [MVP]" <> wrote in message
    news:...
    To get a non-default folder, you need to walk the folder hierarchy using the
    Folders collections or use a function that does that for you. See
    http://www.slipstick.com/dev/code/getfolder.htm

    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:Oqzqb.95807$9E1.459957@attbi_s52...
    > Sorry to be a pest <grin>
    >
    > If I wanted it to add the contact info into a diff folder, would I change
    > the
    > Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    > to
    > Set colContacts = "MyContactFolderNameHere"
    > If not, how would I cahnge the folder?
    > thanks
    >
     
    BruceJ, Nov 7, 2003
    #17
  18. It's almost always better in Outlook to get objects one at a time before using their properties, e.g.

    Set objFolder = GetFolder("Personal Folders\BPContacts")
    If Not objFolder Is Nothing Then
    Set colContacts = objFolder.Items
    Else
    MsgBox "Could not get a MAPIFolder object for Personal Folders\BPContacts"
    End If

    How did you declare colContacts?

    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message news:kVEqb.97707$9E1.471330@attbi_s52...
    > Sue,
    > Am I doing this correctly? How would I use the getfolder() within the
    > function AddRecipToContacts to set the desired contact folder (it is on the
    > root of my Personal Folders) so I thought it should be "personal
    > folders/BPConstacts"
    >
    > ' Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    > Set colContacts = GetFolder("Personal Folders\BPContacts").Items
    > I get an error13 Type mismatch
    >
    > If I do
    > Set colContacts = GetFolder("BPContacts").Items
    > I get a run time error 91 object varible or With block varible not set
    >
     
    Sue Mosher [MVP], Nov 7, 2003
    #18
  19. BruceJ

    BruceJ Guest

    Getting closer!!! Now, it seems to be finding the record (if present) but it
    is adding it to the default olContactItem.
    How can I tell what GetFolder is finding? Is there a way to display the
    value? And what SHOULD it look like Iif I am calling the directory the right
    name?

    Also, in the portion that adds the contact:
    If objContact Is Nothing Then
    MsgBox "Adding ..."
    Set objContact = Application.CreateItem(olContactItem)
    With objContact
    .FullName = objSRecip.Name
    .Email1Address = strAddress
    .Save
    End With
    End If

    how do I force a location for the item?
    below is the module as it stands.
    Thanks
    Bruce
    ------------------------

    Sub AddRecipToContacts(objMail As MailItem)
    Dim strFind As String
    Dim strAddress As String
    Dim objSMail As Redemption.SafeMailItem
    Dim objSRecip As Redemption.SafeRecipient
    Dim objNS As NameSpace
    Dim colContacts As Items
    Dim objContact As ContactItem
    Dim i As Integer

    ' process message recipients
    Set objSMail = CreateObject("Redemption.SafeMailItem")
    objMail.Save
    objSMail.Item = objMail
    Set objNS = Application.GetNamespace("MAPI")
    'Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    Set objFolder = GetFolder("Personal Folders\BPContacts")
    If Not objFolder Is Nothing Then
    Set colContacts = objFolder.Items
    MsgBox "Got info for Personal Folders\BPContacts"
    If Not colContacts Is Nothing Then
    MsgBox "colcontacts has value"
    Else
    MsgBox "colcontacts is empty"
    Stop
    End If


    Else
    MsgBox "Could not get a MAPIFolder object for Personal
    Folders\BPContacts"
    End If


    For Each objSRecip In objSMail.Recipients
    ' check to see if the recip is already in Contacts
    strAddress = objSRecip.Address
    For i = 1 To 3
    strFind = "[Email" & i & "Address] = " & _
    AddQuote(strAddress)
    Set objContact = colContacts.Find(strFind)
    'Stop
    If Not objContact Is Nothing Then
    Stop
    Exit For
    End If
    Next
    Stop
    ' if not, add it
    If objContact Is Nothing Then
    MsgBox "Adding ..."
    Set objContact = Application.CreateItem(olContactItem)
    With objContact
    .FullName = objSRecip.Name
    .Email1Address = strAddress
    .Save
    End With
    End If
    'Stop
    Set objContact = Nothing
    Next

    Set objSMail = Nothing
    Set objSRecip = Nothing
    Set objNS = Nothing
    Set colContacts = Nothing
    End Sub
    "Sue Mosher [MVP]" <> wrote in message
    news:%...
    It's almost always better in Outlook to get objects one at a time before
    using their properties, e.g.

    Set objFolder = GetFolder("Personal Folders\BPContacts")
    If Not objFolder Is Nothing Then
    Set colContacts = objFolder.Items
    Else
    MsgBox "Could not get a MAPIFolder object for Personal
    Folders\BPContacts"
    End If

    How did you declare colContacts?

    --
    Sue Mosher, Outlook MVP
    Outlook and Exchange solutions at http://www.slipstick.com
    Author of
    Microsoft Outlook Programming: Jumpstart
    for Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:kVEqb.97707$9E1.471330@attbi_s52...
    > Sue,
    > Am I doing this correctly? How would I use the getfolder() within the
    > function AddRecipToContacts to set the desired contact folder (it is on

    the
    > root of my Personal Folders) so I thought it should be "personal
    > folders/BPConstacts"
    >
    > ' Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    > Set colContacts = GetFolder("Personal Folders\BPContacts").Items
    > I get an error13 Type mismatch
    >
    > If I do
    > Set colContacts = GetFolder("BPContacts").Items
    > I get a run time error 91 object varible or With block varible not set
    >
     
    BruceJ, Nov 7, 2003
    #19
  20. BruceJ

    BruceJ Guest

    I figured it out! I am using
    Set objContact = objFolder.Items.Add(olContactItem)
    Now... I just need to figure out the name for the fields and stuff those
    with the info I need!

    Thanks!

    Bruce

    "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    news:lRPqb.98373$mZ5.638456@attbi_s54...
    > Getting closer!!! Now, it seems to be finding the record (if present) but

    it
    > is adding it to the default olContactItem.
    > How can I tell what GetFolder is finding? Is there a way to display the
    > value? And what SHOULD it look like Iif I am calling the directory the

    right
    > name?
    >
    > Also, in the portion that adds the contact:
    > If objContact Is Nothing Then
    > MsgBox "Adding ..."
    > Set objContact = Application.CreateItem(olContactItem)
    > With objContact
    > .FullName = objSRecip.Name
    > .Email1Address = strAddress
    > .Save
    > End With
    > End If
    >
    > how do I force a location for the item?
    > below is the module as it stands.
    > Thanks
    > Bruce
    > ------------------------
    >
    > Sub AddRecipToContacts(objMail As MailItem)
    > Dim strFind As String
    > Dim strAddress As String
    > Dim objSMail As Redemption.SafeMailItem
    > Dim objSRecip As Redemption.SafeRecipient
    > Dim objNS As NameSpace
    > Dim colContacts As Items
    > Dim objContact As ContactItem
    > Dim i As Integer
    >
    > ' process message recipients
    > Set objSMail = CreateObject("Redemption.SafeMailItem")
    > objMail.Save
    > objSMail.Item = objMail
    > Set objNS = Application.GetNamespace("MAPI")
    > 'Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    > Set objFolder = GetFolder("Personal Folders\BPContacts")
    > If Not objFolder Is Nothing Then
    > Set colContacts = objFolder.Items
    > MsgBox "Got info for Personal Folders\BPContacts"
    > If Not colContacts Is Nothing Then
    > MsgBox "colcontacts has value"
    > Else
    > MsgBox "colcontacts is empty"
    > Stop
    > End If
    >
    >
    > Else
    > MsgBox "Could not get a MAPIFolder object for Personal
    > Folders\BPContacts"
    > End If
    >
    >
    > For Each objSRecip In objSMail.Recipients
    > ' check to see if the recip is already in Contacts
    > strAddress = objSRecip.Address
    > For i = 1 To 3
    > strFind = "[Email" & i & "Address] = " & _
    > AddQuote(strAddress)
    > Set objContact = colContacts.Find(strFind)
    > 'Stop
    > If Not objContact Is Nothing Then
    > Stop
    > Exit For
    > End If
    > Next
    > Stop
    > ' if not, add it
    > If objContact Is Nothing Then
    > MsgBox "Adding ..."
    > Set objContact = Application.CreateItem(olContactItem)
    > With objContact
    > .FullName = objSRecip.Name
    > .Email1Address = strAddress
    > .Save
    > End With
    > End If
    > 'Stop
    > Set objContact = Nothing
    > Next
    >
    > Set objSMail = Nothing
    > Set objSRecip = Nothing
    > Set objNS = Nothing
    > Set colContacts = Nothing
    > End Sub
    > "Sue Mosher [MVP]" <> wrote in message
    > news:%...
    > It's almost always better in Outlook to get objects one at a time before
    > using their properties, e.g.
    >
    > Set objFolder = GetFolder("Personal Folders\BPContacts")
    > If Not objFolder Is Nothing Then
    > Set colContacts = objFolder.Items
    > Else
    > MsgBox "Could not get a MAPIFolder object for Personal
    > Folders\BPContacts"
    > End If
    >
    > How did you declare colContacts?
    >
    > --
    > Sue Mosher, Outlook MVP
    > Outlook and Exchange solutions at http://www.slipstick.com
    > Author of
    > Microsoft Outlook Programming: Jumpstart
    > for Administrators, Power Users, and Developers
    > http://www.outlookcode.com/jumpstart.aspx
    >
    > "BruceJ" <oe*NOSPAM*@connecting4income.com> wrote in message
    > news:kVEqb.97707$9E1.471330@attbi_s52...
    > > Sue,
    > > Am I doing this correctly? How would I use the getfolder() within the
    > > function AddRecipToContacts to set the desired contact folder (it is on

    > the
    > > root of my Personal Folders) so I thought it should be "personal
    > > folders/BPConstacts"
    > >
    > > ' Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    > > Set colContacts = GetFolder("Personal Folders\BPContacts").Items
    > > I get an error13 Type mismatch
    > >
    > > If I do
    > > Set colContacts = GetFolder("BPContacts").Items
    > > I get a run time error 91 object varible or With block varible not set
    > >

    >
    >
     
    BruceJ, Nov 7, 2003
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernie McAlister

    Macros disabled

    Bernie McAlister, Aug 23, 2003, in forum: Computer Support
    Replies:
    1
    Views:
    516
    °Mike°
    Aug 23, 2003
  2. Replies:
    8
    Views:
    1,050
  3. tony
    Replies:
    2
    Views:
    569
  4. Cynicor

    Histograms and flower macros

    Cynicor, Apr 1, 2006, in forum: Digital Photography
    Replies:
    6
    Views:
    375
    John Falstaff
    Apr 3, 2006
  5. Tony Belding

    macros and close-up "filters"

    Tony Belding, Jan 1, 2007, in forum: Digital Photography
    Replies:
    13
    Views:
    725
    Floyd L. Davidson
    Jan 2, 2007
Loading...

Share This Page