Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default How to create a trigger macro in Excel

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How to create a trigger macro in Excel

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.


" 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default How to create a trigger macro in Excel

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.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default How to create a trigger macro in Excel

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!


" 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger macro on value only [email protected] Excel Programming 4 September 6th 06 09:28 PM
Another way to trigger a macro? Leon[_5_] Excel Programming 1 December 22nd 05 06:03 AM
how to make the barcode reader trigger a macro in excel. CSL Excel Programming 3 July 19th 05 05:05 PM
Trigger a Macro in MS Access from an Excel Macro? DonRetd Excel Programming 13 March 30th 05 09:52 PM
EXCEL: trigger web query from macro? Krick Excel Programming 0 August 5th 03 09:12 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"