+ Reply to Thread
Results 1 to 5 of 5

Problem with VBA code to attach file to email using a pre saved Outlook template

  1. #1
    Registered User
    Join Date
    07-22-2013
    Location
    Sydney, NSW
    MS-Off Ver
    Excel 2007
    Posts
    5

    Problem with VBA code to attach file to email using a pre saved Outlook template

    Hello,

    Forgive me for being somewhat of a novice with macro coding but I have a code that works for me on my computer but does not work when my colleagues attempt to do so on theirs.
    Background: I have an inventory update file that I prepare for my colleagues each day. Many of the functions that create the update file are controlled by macros. To make the update and distribution of the file as quick and simple as possible I wrote a macro to attach the file to an Outlook template. The Outlook template contains a whole lot of information in the body and all the email addresses of the recipients. I attached that macro to a command button on the form.
    It works great for me. I click the command button and everything works.
    But when I am not in the office, the update function and distribution needs to be handled by someone else. For that reason, I stored the Outlook template (otf file) on one of our network drives.

    However, when my colleagues attempt to run that macro on their computer it does not send the email.
    Here is the code:

    Please Login or Register  to view this content.
    Any help with what I'm doing wrong here would be greatly appreciated.
    Thank you.
    Last edited by Wooltrain; 04-12-2017 at 07:28 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Problem with VBA code to attach file to email using a pre saved Outlook template

    Hi,

    Which line is highlighted when the error occurs?

    Would you also add code tags to your original post - as required by our rules.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-22-2013
    Location
    Sydney, NSW
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Problem with VBA code to attach file to email using a pre saved Outlook template

    Hi Richard,

    That's the strange thing, the macro runs all the way through. It doesn't throw up an error.
    No debug messages. No highlighted code.
    It behaves as if it has worked but the email never gets sent.

    This code works just fine on my computer. Everything behaves as expected. It is only when I try and run it on a different machine that the email does not send.

  4. #4
    Forum Contributor
    Join Date
    06-07-2016
    Location
    Manila
    MS-Off Ver
    365
    Posts
    292

    Re: Problem with VBA code to attach file to email using a pre saved Outlook template

    Hi Wool,

    try to remove the on error resume next so that you can see which error will be highlighted.

  5. #5
    Registered User
    Join Date
    07-22-2013
    Location
    Sydney, NSW
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Problem with VBA code to attach file to email using a pre saved Outlook template

    Hi all,

    I removed the "on error resume next" and ran it on three different computers.
    The macro worked perfectly each time.
    Still no errors showing, but it's working!

    Thanks for the assists!

+ 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. attach file in an outlook email from specific folder
    By 9599lorenzo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2017, 07:07 AM
  2. Attach last saved file outlook/add this to quick step in Outlook
    By Nravota in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 06-25-2015, 06:25 AM
  3. Code to attach file paths to email
    By petaaalouise in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-22-2015, 02:54 AM
  4. [SOLVED] Macro to attach an additional file to and outlook email
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2014, 01:27 PM
  5. Email merge from excel merge file using pre-saved word template
    By d_max_c in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2014, 12:33 PM
  6. [SOLVED] Email Macro to attach a non active worksheet to outlook email
    By mickgibbons1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-21-2013, 08:38 PM
  7. Code to attach a sheet as an Outlook email attachment
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-30-2011, 11:32 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