Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom -
Thanks for the link.. I actually have read that page many many times. Forgive me - but this is my first time working with events.. an actually, the first time using VBA. So far, the code I have come up with will run the macro when making change to the worksheet. I would like this to run the macro only upo closure of the workbook. Any suggestions on what I should change? B the way, all of this code is placed in "Sheet1". Thanks for *any* help anyone can and / or has provided! Andrew Private Sub Worksheet_Change(ByVal Target As Excel.Range) Application.EnableEvents = False Call CDO_Send Application.EnableEvents = True End Sub Sub CDO_Send() Dim iMsg As Object Dim iConf As Object Dim Flds As Variant Dim WB As Workbook Dim WBname As String Dim cell As Range Application.ScreenUpdating = False Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") iConf.Load -1 ' CDO Source Defaults Set Flds = iConf.Fields With Flds .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = "163.186.80.4" .Item(cdoSMTPServerPort) = 25 .Update End With For Each cell I Sheets("Sheet1").Columns("J").Cells.SpecialCells(x lCellTypeConstants) If cell.Offset(0, 1).Value < "" Then If cell.Value Like "*@*" And cell.Offset(0, 1).Value "yes" Then With iMsg Set .Configuration = iConf .To = cell.Value .From = """Inventario de Almacen"" <" .Subject = "Comprar Partes" .TextBody = "Dear " & cell.Offset(0, -1).Value & vbNewLine vbNewLine & _ "Part number needs to be ordered." .Send End With End If End If Next cell Set iMsg = Nothing Set iConf = Nothing Set WB = Nothing Application.ScreenUpdating = True End Su -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need to automatically number order forms in excel upon opening? | Excel Discussion (Misc queries) | |||
Email, forms, Excel, Infopath, Sharepoint | Excel Discussion (Misc queries) | |||
Excel 97 generating email automatically starts Lotus 6. DefaultOK | Excel Discussion (Misc queries) | |||
How do I automatically send daily email of updated Excel workbook. | Excel Discussion (Misc queries) | |||
Excel Forms - text fields decompressing font automatically | Excel Discussion (Misc queries) |