+ Reply to Thread
Results 1 to 8 of 8

HELP! Need help with macro that automatically sends email when...

  1. #1
    Registered User
    Join Date
    08-27-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    4

    HELP! Need help with macro that automatically sends email when...

    Hi,

    I am putting together a database that will track inventory. I am trying to make a set of macros that will allow my excel workbook to automatically send an email whenever any cell in a specific column (actualy inventory) is less than the respective cell in the column adjacent to it (minimum stock). I copied most of this from examples online. Now the email sending macro works fine, I need help with the trigger macro to automatically send the email when the correct conditions are met (a cell in column C has a value less than a column on the same row in D, eg. c3<d3) So far I am losing sleep and getting nowhere... Please help! Here is what I have so far:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    F
    Last edited by arlu1201; 08-27-2013 at 09:15 AM. Reason: Use code tags in future.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: HELP! Need help with macro that automatically sends email when...

    Are you sending an email for each line found with depleted stock? Or one email with all lines of depleted stock?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    08-27-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: HELP! Need help with macro that automatically sends email when...

    An email sent as soon as something drops below minimum stock limit. And if its possible, if any items aren't replenished, then included in the email sent whenever something else drops below minimum stock. Now I dont know if thats possible, but it would be amazing!

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: HELP! Need help with macro that automatically sends email when...

    Okay, just a few details...

    1. Are you sending emails via outlook? <------- Should have just looked at your code to realize you're using outlook
    2. What column is your actual stock level in?
    3. What column is your minimal stock level in?
    Last edited by Solus Rankin; 08-27-2013 at 01:15 PM. Reason: dumb question

  5. #5
    Registered User
    Join Date
    08-27-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: HELP! Need help with macro that automatically sends email when...

    Ummm, my actual stock level goes from $C2 to $C1000. My minimal stock level goes from $D2 to $D1000. Ultimately, every worksheet in the workbook will be designated for a different bin, meaning I could end up with a 6-8 page workbook. Im not sure if that makes things harder, I assumed I could use the code developed for one worksheet and copy it to the other worksheets. Or maybe make the macro for the entire workbook, but I dont know for sure how thats done. I'm still relatively new to this...

  6. #6
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: HELP! Need help with macro that automatically sends email when...

    Try placing this in your workbook module:
    Please Login or Register  to view this content.
    It should work on any sheet in the workbook as long as the inventory level is always in column C and the minimum quant is always in column D.
    Last edited by Solus Rankin; 08-28-2013 at 08:34 AM.

  7. #7
    Registered User
    Join Date
    08-27-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: HELP! Need help with macro that automatically sends email when...

    Wow, you're a magician with macros! So far the macro seems to be working exceptionally well. My only problem is that it will open an email at anytime any numbers are put into column C, displaying the items that are below the minimal inventory (meaning even if there is no inventory that needs to be replenished, there will still be an email pulled up). Is there anyway around this?

    Also, Im looking to create a front home page with a table that will allow for searches within the workbook for product numbers and names (with a search button underneath) and display the number in stock for that item, as well as, a quantity input box and a "remove stock" button beside it that will allow someone to simply search, find amount of stock and remove a number of stock from one table. Would you happen to know where I can look for information on how to do this? Maybe a tutorial, or site with sample code?

  8. #8
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: HELP! Need help with macro that automatically sends email when...

    Try changing the first sub to this:
    Please Login or Register  to view this content.
    Good training materials (but probably not samples) can be found here: http://www.excelforum.com/excel-prog...materials.html

    Most (but not all) vba programs are fairly specific to their application. But if you read through the training material and ask questions on this forum I bet you can get through it. What you're asking for sounds pretty straight forward.

+ 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. Email loop only sends first email from outlook.
    By vamosj in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-16-2013, 04:33 PM
  2. VBS/OutMail script and macro sends email message twice
    By Andrew_Harris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2013, 08:57 PM
  3. Replies: 4
    Last Post: 11-20-2012, 06:39 AM
  4. Macro that sends email automatically once a week?
    By GTfan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2012, 02:44 PM
  5. A macro that looks up a email from sheet2 and sends email
    By AdderLee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 02:24 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