View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
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?