+ Reply to Thread
Results 1 to 2 of 2

Macro attached to e-mail with a change of subject

  1. #1
    Registered User
    Join Date
    07-17-2017
    Location
    Eindhoven, Netherlands
    MS-Off Ver
    2010
    Posts
    1

    Macro attached to e-mail with a change of subject

    Hi,

    I'm quite new to the world of macro's, I can record them but not edit or write them myself.

    Now, I want to create a macro which hides some of the tabs (I can do that with the recording) and attaches the Excel file to an e-mail where I can change the e-mailaddress but where the subject is named "PIF".
    Note: the file can't be saved because the macro has to work for all users. We cannot save anything on the main directories or maps. Just in our own user documents.

    Hopefully there is anyone out there who can help me to solve this issue.

    Cheers.

    Regards,

    Niels

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: Macro attached to e-mail with a change of subject

    The following is my module for mailing a file. It requires that Outlook be installed and configured on the machine. It does not have to be running, but the user must be logged in. This macro takes 6 arguments that you can pass to it from another macro:
    -To String (mandatory) - the list of To recipients separated by a semicolon.
    -Subject String (mandatory) - the subject of the message
    -Body String (mandatory) - the body of the message
    -CC String (optional) - the list of CC recipients separated by a semicolon
    -BCC String (optional) - the list of BCC receipitents separated by a semicolon
    -Attachment Name (optional) - the name of a file to attach. - note: if you are attaching the workbook that is running this program do thisworkbook.save first.

    So here is how it would be called for two emails in the To line, no CCs or BCCs and an attachment.

    Mail_Workbook "email1@address1;email2@address2", "Subject of the message", "Body of the message",,,"\\ServerName\DirectoryName\WorkbookName.xlsx"

    Please Login or Register  to view this content.
    P.S. you can read any of the above parameters, such as email address, from a cell.
    Last edited by dflak; 07-17-2017 at 03:22 PM. Reason: Add PS
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ 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. Outlook Macro to save mail attachment from a specific sender with subject line
    By manoj.0790 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-17-2016, 09:34 AM
  2. Send email integrating cell data into Subject and Body, with attached invoice
    By KarBar110 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-08-2012, 05:36 PM
  3. Mail subject number to excel macro
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2012, 04:48 PM
  4. Want to change attached file name & subject line in the coding : Email Range
    By Kapil007 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-30-2010, 07:45 AM
  5. Trying to save mail attachments with the mail subject as the filename
    By thereth in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2010, 05:31 AM
  6. Sending mail with Excel file attached, and cell-value inserted in Subject line
    By arunjoshi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-07-2005, 09:41 AM
  7. Excel macro - sending mail with value of cell inserted in the subject line
    By arunjoshi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-07-2005, 04:42 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