- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¦^´_ 11# missbb
¸Õ¸Õ¬Ý- Option Explicit
- Sub ex()
- Set d = CreateObject("Scripting.Dictionary")
- With Worksheets("attendance report")
- For Each a In .Range(.[E4], .[E4].End(xlDown))
- d(a.Value) = "" '¨ú±o©Ò¦³¤£«½Æ¤À©±
- Next
- F = InputBox("Enter your month")
- For Each ky In d.keys
- .Range("B4").AutoFilter Field:=4, Criteria1:=ky
- If Dir("C:\Users\mariasfy\Desktop\" & ky & "_" & F & ".pdf") <> "" Then Kill "C:\Users\mariasfy\Desktop\" & ky & "_" & F & "201507.pdf" '¦P¦WÀɮקR°£
- .ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
- "C:\Users\mariasfy\Desktop\" & ky & "_" & F & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, _
- IgnorePrintAreas:=False, OpenAfterPublish:=False '¥t¦s¦¨PDFÀÉ®×
- '************************************************************
- SendMail "C:\Users\mariasfy\Desktop\" & ky & "_" & F & ".pdf"
- '************************************************************
- Next
- End With
- End Sub
- Sub SendMail(xFile As String)
- 'VBA ¥\¯àªí«ü¥O: ¤u¨ã->³]©w¤Þ¥Î¶µ¥Ø ·s¼W -> [Microsoft CDO for Windows 2000 Library]
- '¥i Google CreateObject("CDO.Message") ¤F¸Ñ
- Dim objEmail As Object
- Set objEmail = CreateObject("CDO.Message") '«Ø¥ß CDO ª«¥ó
- With objEmail
- With .Configuration.Fields
- .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
- .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "msa.hinet.net" '¨Ï¥Î msa.hinet.net ¶Ç°e¶l¥ó
- .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
- .Update
- End With
- .From = "±H¥óªÌ@pchome.com" '±H¥óªÌ¡]ºô°ì¥²¶·¦s¦b¡^
- .To = "¦¬¥óªÌ@gmail.com"
- .Subject = "CreateObjectCDO.Message CDO¶l¥ó´ú¸Õ" '¶l¥ó¥D¦®
- .HTMLBody = "¶l¥ó¥»¤å" 'HTML¶l¥ó¤º¤å
- .AddAttachment xFile 'ªþÀÉ
- .Send
- End With
- End Sub
½Æ»s¥N½X |
|