Tecnologia, programação e muito Visual FoxPro.

terça-feira, 20 de outubro de 2009

]] XL-mania [[ Tidak memapilkan MS Outlook Waring saat menggunakan method 'SendMail'

 

Pakar Excel,

Saya membuat vba code untuk mengirimkan tiap sheet di workbook yang aktif ke alamat email yang berbeda beda,

Sub KirimEmail()
    Dim sht As Worksheet, shtEmail As Worksheet, rgEmail As Range
    Dim strEmail As String, strName As String, wbTmp As Workbook
   
    Set shtEmail = ActiveWorkbook.Worksheets("0") 'sheet berisi nama dan email
    Set rgEmail = shtEmail.[N1].CurrentRegion 'range nama dan email di cells [N1]
   
    For Each sht In ActiveWorkbook.Worksheets
        If sht.Name <> "0" Then
            strName = sht.[D5] 'nama recepient
            On Error Resume Next
            'mengambil alamat email sesuai dengan namanya
            strEmail = Application.WorksheetFunction.VLookup(strName, rgEmail, 2, 0)
            If Err.Number = 0 Then
                Err.Clear
                sht.Copy
                Set wbTmp = ActiveWorkbook
                wbTmp.SendMail strEmail, "LeaveRecord" & strName, True
                wbTmp.Close SaveChanges:=False
            End If
        End If
    Next
End Sub

Program berjalan sesuai harapan.

Cuma pada saat proses sending email tiap sheet, ada verification dari MS Outlook yang harus direspon (as attached). Kalo sheetnya banyakkan report….

Mohon bantuan rekan2 untuk memodifikasi code di atas agar saya tidak harus menge-click terus.

Terimakasih


 

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4524 (20091019) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 

__._,_.___
+-:: XL-mania ::::::::::::::::::::----------------------------------+
| Moderasi akan lambat minggu ini, momods pergi ke tempat jauh      |
| http://www.facebook.com/group.php?gid=37671048001&ref=mf          |
+-------------------------------------------------------------------+
| DILARANG : MLM, money game, OOT, iklan tanpa izin, SARA, testing, |
| pembicaraan pribadi, one line message,  melecehkan,  tidak sopan. |
+-------------------------------------------------------------------+
| Buat subjek yang kreatif, jangan : "tanya", "help", "mohon bantu" |
| Usahakan besar attachment < 200 kb. Gunakan  winzip  jika  perlu. |
+-------------------------------------------------------------------+
| Ajak teman-teman Anda bergabung dengan mengirim e-mail kosong ke  |
| XL-mania-subscribe@yahoogroups.com atau kirimkan mereka file dari |
| http://groups.yahoo.com/group/XL-mania/files/Promotion/           |
+-------------------------------------------------------------------+
| Berikan testimoni di : http://www.friendster.com/xlmania atau...  |
| http://www.xl-mania.com/2008/06/testimoni-xl-mania.html           |
+-------------------------------------------------------------------+
| Message lama ada di :                                             |
| http://groups.yahoo.com/group/XL-mania/messages [perlu yahoo id]  |
| http://www.mail-archive.com/xl-mania@yahoogroups.com              |
+-------------------------------------------------------------------+
Recent Activity
Visit Your Group
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Yahoo! Groups

Weight Management Challenge

Join others who

are losing pounds.

Find helpful tips

for Moderators

on the Yahoo!

Groups team blog.

.

__,_._,___

Nenhum comentário:

Arquivo do blog