+ Reply to Thread
Results 1 to 5 of 5

help editing my code that emails a range of data via outlook.

  1. #1
    Registered User
    Join Date
    04-20-2014
    Location
    London
    MS-Off Ver
    Windows Excel 2010
    Posts
    79

    help editing my code that emails a range of data via outlook.

    Hi guys,

    I have a piece of code that I got online and have slightly tweaked.

    I would like to add the following feature.

    1) When excel creates the temporary excel file I would like it to ask teh user to input a name they would like to call the file. (The file that will be e-mailed), I would prefer this over having to input a standard name in the code.

    2) I would like excel to ask the user who they would like to e-mail the file to and they can input the e-mail address in an input box, which then populate into outlook "to" field before it opens. (This feature isn't as necessary)

    Any help would be great!

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: help editing my code that emails a range of data via outlook.

    Hello. Just insert two input boxes to gather the info.

    Dim fName As String
    Dim eName As String
    fName = InputBox(Prompt:="File Name?", Title:="FILE NAME!", Default:="Please type the file name here.")
    eName = InputBox(Prompt:="E-mail Address?.", Title:="E-MAIL ADDRESS!", Default:="Please type the e-mail here.")



    Code updated:

    Please Login or Register  to view this content.
    Last edited by playaller; 05-27-2014 at 11:48 AM. Reason: Updated file name reference


    Shelton A.
    If Helpful, Add Reputaion!

  3. #3
    Registered User
    Join Date
    04-20-2014
    Location
    London
    MS-Off Ver
    Windows Excel 2010
    Posts
    79

    Re: help editing my code that emails a range of data via outlook.

    The code works great except for one thing.

    The code changed the Subject line of the e-mail instead of the temporary excel file name.

    Could you kindly correct this for myself ? I want to have it as the Fname + todays date/time.

  4. #4
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: help editing my code that emails a range of data via outlook.

    No problem. Here you go.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-20-2014
    Location
    London
    MS-Off Ver
    Windows Excel 2010
    Posts
    79

    Re: help editing my code that emails a range of data via outlook.

    Thank you so much!

    Could I ask you one last thing ebfore I resolve this thread.

    If you press cancel or the x button, you will get an Error 400. Is it possible to change this so that it simply ends the sub without creating a temporary excel file?

    This could be for a situation where someone has accidentally started this macro by clicking a command button but they would like to cancel it.

    I tried putting an error handler in and it worked, but it still created a temporary excel file.

    Any help would be great!

+ 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. VBA code to send automatic emails via outlook based on deadline
    By Britny in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2013, 10:08 AM
  2. [SOLVED] Select folder and date range to get emails from Outlook
    By 2sqrd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2013, 09:51 AM
  3. Does anyone have code to batch extract data from standardised emails [outlook 2010]
    By inciteful in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-18-2013, 03:08 PM
  4. Post not responded too please help macro vba code for outlook emails
    By excelnoob1212 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2012, 11:31 AM
  5. looping through range of cells & sending multiple emails with outlook
    By splosczynski in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2008, 01:49 PM

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