PC Review


Reply
Thread Tools Rate Thread

How to create a trigger macro in Excel

 
 
justin.arnold2@gmail.com
Guest
Posts: n/a
 
      26th Nov 2007
I have a speadsheet with some data in it. If the data meets certain
conditions it needs to be sent out to 2 e-mail receipients. I need to
create a macro that converts this sheet to a pdf and e-mails it to
these two receipients. The variable is Yes or No. If the certain
conditions are met and cell B33 displays 'Yes' then the macro needs to
execute. Since I'm new to this I don't know where to begin. Can
someone help me?
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      26th Nov 2007
1. I have a speadsheet with some data in it.

Put a name to the spreadsheet like Workbooks("Spreadsheet") or
Worksheets("Sheet1") so we all talk the same language


2. If the data meets certain conditions it needs to be sent out to 2 e-mail
receipients.

You are halfway home with this one. Use an If statement to see if the
data meets the criteria for e-mail.
If not then exit the sub.

If Cells(1, 1) = myCriteria Then
'do stuff
Else
Exit Sub 'Get outta here
End If

3. I need to create a macro that converts this sheet to a pdf

See this site:

http://office.microsoft.com/en-us/ex...CL100570551033

and e-mails it to these two receipients.

See this site:
http://www.rondebruin.nl/sendmail.htm

4. The variable is Yes or No. If the certain conditions are met and cell
B33 displays 'Yes' then the macro needs to
execute.

This is a good starting point. Use an If statement to see if conditions
are met.
If Worksheets("Sheet1").Range("B33") = myCondition Then
'Continue process
Else
Exit sub
End If

So Here is the logic:

Sub sndPDF()
If Worksheets("Sheet1").Range("B33") = myCondition Then
'Convert file to PDF
'Open e-mail application (Outlook?)
'Send as attachment or in body of e-mail?
'Save file
'Close e-mail application
End If
Close workbook
End Sub

Have fun.


"(E-Mail Removed)" wrote:

> I have a speadsheet with some data in it. If the data meets certain
> conditions it needs to be sent out to 2 e-mail receipients. I need to
> create a macro that converts this sheet to a pdf and e-mails it to
> these two receipients. The variable is Yes or No. If the certain
> conditions are met and cell B33 displays 'Yes' then the macro needs to
> execute. Since I'm new to this I don't know where to begin. Can
> someone help me?
>

 
Reply With Quote
 
justin.arnold2@gmail.com
Guest
Posts: n/a
 
      27th Nov 2007
Thanks for your help. After looking into this a little more I've
decided that instead of converting the worksheet to a PDF and then e-
mailing it I would like to just send an e-mail alert to 2 e-mail
receipients notifing them that they need to take action. If Cell B33 =
Yes then send an e-mail alert saying "Please check your work area for
problems". I would also like the macro to run when the spreadsheet is
first opened, this way I can make it a scheduled task and have it
automatically run everyday at 8am. I have a few other spreadsheets
that work like this however I did not create them. The employee who
created these sheets is no longer with the company and I am now
responsible. I have never done anything like this before and I would
appreciate any help getting started with this. Thanks again for your
help.
 
Reply With Quote
 
Aran Black
Guest
Posts: n/a
 
      27th Nov 2007
Hi Justin,
There is an event that triggers whnever a sheet opens. It is called
worksheet_activate. You should put any code(routine) you want in there.

If you want Excel to create an email message for you all you have to do is
use the Macro recorder to record this! Start your macro recorder and then go
to your File menu then click on the "Send To..." item on the menu. Then click
on the "Send with attachment" item that pops up after. Your macro recorder
will have recorded the basis for your code!!

Let me know how that goes.
Please rate this answer!

Aran



--
It wasnt Jesus it was just a fella!
God Bless America!


"(E-Mail Removed)" wrote:

> Thanks for your help. After looking into this a little more I've
> decided that instead of converting the worksheet to a PDF and then e-
> mailing it I would like to just send an e-mail alert to 2 e-mail
> receipients notifing them that they need to take action. If Cell B33 =
> Yes then send an e-mail alert saying "Please check your work area for
> problems". I would also like the macro to run when the spreadsheet is
> first opened, this way I can make it a scheduled task and have it
> automatically run everyday at 8am. I have a few other spreadsheets
> that work like this however I did not create them. The employee who
> created these sheets is no longer with the company and I am now
> responsible. I have never done anything like this before and I would
> appreciate any help getting started with this. Thanks again for your
> help.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
trigger excel macro with VBA Timmy Microsoft Access 2 27th Jan 2009 07:12 PM
how to make the barcode reader trigger a macro in excel. CSL Microsoft Excel Programming 3 19th Jul 2005 05:05 PM
Trigger a Macro in MS Access from an Excel Macro? =?Utf-8?B?RG9uUmV0ZA==?= Microsoft Excel Programming 15 30th Mar 2005 09:52 PM
Trigger a Excel Macro from within Access johnb Microsoft Access Macros 2 9th Dec 2004 02:09 PM
EXCEL: trigger web query from macro? Krick Microsoft Excel Programming 0 5th Aug 2003 09:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:33 PM.