+ Reply to Thread
Results 1 to 3 of 3

VBA not working in Outlook 2016

  1. #1
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    VBA not working in Outlook 2016

    Hello,

    I have the below codes that worked in 2010 outlook (sending all drafts in the draft folder). but it stopped working in 2016, I got error message saying Outlook doesn't recognize one or more names and the yellow line is highlighted on "oFolder.Items(1).Send"

    PHP Code: 
    Sub Send()

    Dim oFolder As Folder
    Dim oNS 
    As NameSpace
    Dim olMail As MailItem

        Set oNS 
    Outlook.Application.GetNamespace("MAPI")

        
    Set oFolder oNS.GetDefaultFolder(olFolderDrafts)

        For 
    1 To oFolder.Items.Count
        oFolder
    .Items(1).Send
        Next


    Set oNS 
    Nothing
    End Sub 

    can someone please let me know how to fix it?

    thanks!
    Last edited by 6StringJazzer; 10-17-2019 at 10:39 AM. Reason: Moved from Outlook Formatting & Functions

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,703

    Re: VBA not working in Outlook 2016

    This code works for me in Outlook 2019. There is probably something else that changed other than just your upgrade to 2016. Is there any other code in the same module that contains this? The first and easiest thing to try is to declare i. Also, how many items are in the Draft folder when you run this?
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    273

    Re: VBA not working in Outlook 2016

    I'm not aware of anything that has been changed. I found some other codes online and it seems to work. thanks very much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Migration from outlook express to outlook 2016
    By charlesjenkins in forum Excel General
    Replies: 1
    Last Post: 10-10-2019, 05:00 AM
  2. Multiple attachment is not working Excel/Outlook 2016
    By lapot in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-06-2019, 10:06 AM
  3. Need help on Outlook Macros 2016
    By KushalCoorg in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 12-06-2018, 07:46 AM
  4. [SOLVED] Issue send email with excel 2016 true outlook 2016
    By kirana2014 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-12-2017, 11:34 AM
  5. Help! Automated Email coding for Excel 2016 and Outlook 2016 problems
    By lisa6421 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-01-2017, 08:07 AM
  6. VBA Send email from outlook 2016
    By kirana2014 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-30-2017, 01:29 PM
  7. Emailing Individual Worksheets as a PDF using Outlook 2016
    By karima_e in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-19-2017, 11:16 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1