+ Reply to Thread
Results 1 to 24 of 24

Email from Excel

  1. #1
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Email from Excel

    hi All,

    Its probably an old topic but I would really appreciate some help with this.
    I am trying to use this spread sheet to manage our purchasing requirements .

    I need to get an email sent to the address listed in u2 and v2 , when anything becomes "DUE" in the column Q.

    Subject of the email

    Job no - from cell "A4"
    Component due - from the column U , corresponding to the item that has become "DUE" in Column "Q"

    and the Text DUE.

    Dont really need anything in the body of the email.
    But wouldn't hurt to have the "REQD" date listed in the body.

    Body :
    This is due on on , the date from the column "I" corresponding to the item that has become due.

    I am very new to VBA , any help would be greatly appreciated.

    Thanks
    Kind Regards
    winsomeness

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    so one email every time you run macro?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    Please Login or Register  to view this content.
    i've set it to display instead of straight send
    you can change it to send by taking the ' away from in front of send and putting ' in front of display

    ps the email looks abit out of wack due to some of your descriptions having carriage returns (line breaks in them)....the macro just copies it straight in
    Last edited by humdingaling; 08-14-2014 at 03:43 AM. Reason: change i =2 to 6 in your book...the loop doesn't need to start from 2

  4. #4
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    the idea is that the user gets multiple emails.

    Which ever item is due on column Q , one email for every item that is due .

    the information to be emailed should be

    Job no from "A4"
    corresponding component name from "U" and also may be when it was actually required from Column "I"

  5. #5
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    perfect .thanks humdingaling.

    Is there any way to do this automatically when the sheet is opened , without having to run the macro
    thanks again

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    one email for every item that is due to the two emails in u2 and v2?

    you can move the macro to thisworkbook
    the sub will have to be renamed

    Private Sub Workbook_Open()

    End Sub

  7. #7
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    that's brilliant . now just have to worry about all the emails that will come through everyday.
    I dont suppose there is any way to only email once for everyday , is there ?

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    yes there is
    basically kept a register on the excel sheet
    will tick once sent
    only thing is you will have to save every time you exit the book

    however will have to be tomorrow i am knocking off home

  9. #9
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    That's great.

    Or would there be an option where I could open say 20 workbooks at once .
    Use a shortcut Key to run the code across all the open workbooks.

    So it does not matter if someone else opens the sheet later in the day or even if I have to open the sheets later in the day.
    the code wont run unless the shortcut key is used.

    I wouldn't want to hit the shortcut key 20 times , it would be good if the shortcut works across all open workbooks.

    let me know what you think

    Kind Regards
    winsomeness

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    while what you are requesting could be done
    i dont recommend it for two main reason
    it starting to sound extremely fiddly in nature and unless tight controls on how things are done are put in place, things will go wrong

    which goes onto my second point
    should you want to do this, you really would need to know how it works and how to amend it

    this said, if you want to go down this track i am happy to help you along the way
    so the way i see it happening

    you have all your workbooks you want email macro to be run in a specified folder (only have files that you want run and use the same template in this folder or else things will go wrong...alternatively have spreadsheets named in a certain way).
    the physically controlling what is in folders would be easier approach

    you will have another workbook called registry (in seperate folder)
    upon opening it will check if macro has been run today

    if not it will run macro that will
    ...
    open workbook
    run the macro for email
    close workbook
    go to next workbook until no more workbooks in folder

    after which it will indicate on your register it has been done...after which you will save and close register

    let me know if you want to proceed
    ....quite the system you are requesting here

  11. #11
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    hmm ..

    I have a folder called "Purchasing Aids "
    Within which I have this file

    ".Template - Purchasing schedule calculator rev 10"

    Each time a new Job is released , I would copy this template and paste within the same folder
    Rename it to "JOB no - Purchasing schedule calculator rev 10"

    so every time i will delete ".Template" and replace it with the unique Job number say "2060"
    at the moment i have about 30 Jobs so 30 individual spread sheets.

    so it will look like "2060 - Purchasing schedule calculator rev 10"

    As Jobs are completed I will simply move them into a another folder "completed"
    I will take your suggestion , which ever way you think is best to manage it , I will be happy to follow


    let me know what you think
    Kind Regards
    winsomeness

  12. #12
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    attached is example of what i mean by registry file
    i have blanked out code for opening workbooks so it only does the registry function

    play around with file

    open file you should get a msgbox
    delete 15th Aug line save and close
    open it again
    it should add new line
    Attached Files Attached Files

  13. #13
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    on your template file you have some code

    Please Login or Register  to view this content.
    do you use this?
    if not you dont have to save your template as XLSM
    have the EMAIL macro on your registry instead

  14. #14
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    i downloaded the registry file
    deleted 15 aug line and saved
    opened again
    it entered the line again and put a y next to it

    then i opened my template , i got the email about the "due" items based on the code you provided yesterday.
    I saved and closed it .
    Opened it again and was hoping that it does not send the email again . but got the email again.

    How do I make the macro refer to regsitry.

    That code , I think i had that when i was trying before I got the code from you.
    I have deleted all that after I got your code

  15. #15
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    with this new method i am proposing i would have the macro for emailing on the registry file itself instead of the template
    but in order to do this i need to know if your template needs to be a xlsm file or not

    the registry macro intends to open all your files in specified folder automatically

  16. #16
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    the files can just be xslx

  17. #17
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    The files can be "xlsx"

    I thought they had to be xlsm for the macro to work
    so they do not have to be xlsm

  18. #18
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    the files need to be xlsm if you need/require any macros on the individual files themselves
    but if your using a registry to control everything then the templates themselves do not require to be xlsm....the only thing is you had some worksheet change macro on your template but i did not think it was doing anything

  19. #19
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    oh ok so thats what the xlsm is

    No the individual template sheet is actually just a "xlsx".

    I made it into a macro enabled file just before uploading here.
    So i shall leave that as "xlsx" and delete all codes from the VB developer section.

    Shall wait for the new code that you are working and just use it on the registry spreadsheet within the same folder as you had suggested.

  20. #20
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    attached version 2 of registry

    updated macro so you can see what i have done
    included as much comments as possible so you can follow what is happening

    made it a zip file so i included the registry file + test folder and some dummy files

    you will just need to change on the registry file
    this line to match where you have placed the dummy template
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    hi mate

    I tried it

    changed the location on the registry file
    Const strFolder As String = "M:\Procurement\Purchasing\Purchasing aids\WIP\Winsomness\Test" 'folder in which all your files are kept

    Deleted 15th aug saved and closed
    open the registry - winsomeness v2 file

    It enters 15th aug and enters Y and no emails sent is still o
    and i am not getting any emails.

    I changed the cell inside the spread sheet to have an actual email address
    I have deleted ' in front of send and put it infront of display and still no emails being sent

    any ideas ?

    Please advise accordingly

    Kind Regards
    winsomeness

  22. #22
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    try this

    Const strFolder As String = "M:\Procurement\Purchasing\Purchasing aids\WIP\Winsomness\Test\"

  23. #23
    Registered User
    Join Date
    08-10-2014
    Location
    Perth,Australia
    MS-Off Ver
    2010
    Posts
    18

    Re: Email from Excel

    done
    thats just going to make things so much easier

    thanks heaps

    Kind Regards
    winsomeness

  24. #24
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Email from Excel

    not a problem
    have a play around

    i believe i left enough comments in the code so you can see what does what
    if happy with the solution please mark thread as solved

    Cheers
    Hum

+ 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. How to send email from excel using VBA with Cell Range (Including Images) as Email Body
    By Novice_To_Excel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-24-2014, 05:06 AM
  2. vba pull data from outlook body of email through email or subject of mail into excel
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2014, 04:37 AM
  3. Replies: 2
    Last Post: 02-14-2014, 12:03 AM
  4. [SOLVED] Extracting email chain email address and converting to Excel column
    By Leah_Hael in forum Excel General
    Replies: 4
    Last Post: 12-28-2012, 04:05 PM
  5. How to parse data in Outlook email using HTML version of email back to excel
    By bnasty in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 10-31-2012, 02:54 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