+ Reply to Thread
Results 1 to 7 of 7

Macro to create new MS Office email

  1. #1
    Registered User
    Join Date
    07-06-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    3

    Macro to create new MS Office email

    I need a macro that will create a new email and will copy cell contents into the email subject line and body:

    Email Subject: 'Content of cellA1' 'Content of cell B1' subject text

    Email body: 'Content of cellA1' email body text 'Content of cellB1' text

  2. #2
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Macro to create new MS Office email

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-22-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to create new MS Office email

    Hi Whizbang,

    Nice work - If I want to send the email with the excel file as an attachment, what does I need to add to the code then?

    I´m not an expert in vba coding, so sorry if the answer is to obvious

  4. #4
    Registered User
    Join Date
    06-22-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to create new MS Office email

    Ok I was a bit to quick - pretty obvious I just have to add
    .Attachments.Add ActiveWorkbook.FullName

    Bu the questions just keeps comming

    Is it possible in excel to make a makro that execute every day at 8 pm?

  5. #5
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Macro to create new MS Office email

    I am sure there is, but I'd have to look around and see what other people have done. The problem with having a macro automatically run at a certain time is that a) The workbook would have to remain open until 8pm, and b) there would have to be some sort of OnTime loop that checks the time every second until it is 8pm.

    Probably the easier way would be to create a workbook with some code in the Open event that then processes whatever you need processed. Then set up a task in the Windows Task Scheduler to open up the file at 8pm.

  6. #6
    Registered User
    Join Date
    06-22-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to create new MS Office email

    ok thanks whiz..

    You are right, it would probably be more straightforward and also very useful to make the macro run when the workbook is opened.

    I hope I can ask you one last question then:

    How do I auto-run my macro when the workbook is opened?

    Again thank you very much for your answers whiz, you have been very helpful
    Last edited by laric; 08-16-2011 at 09:11 AM.

  7. #7
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Macro to create new MS Office email

    Here is a simple description of how to set up code in the Workbook Open event:
    http://www.ozgrid.com/VBA/auto-run-macros.htm

    Here is a much more detailed explaination of Events in general:
    http://www.cpearson.com/excel/Events.aspx

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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