ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] VBAµomail²§±` x32

VBAµomail²§±` x64

¦U¦ì¡A½ÐÀ°¦£¸Ñ´b¤@¤U ~
¥ý«e¦³¤ÏÀ³x64µo°e¶l¥ó·|¥X²{²§±`¡A«á¨Ó¤w¸g¦³±Æ°£¡C
¦ý¤£ª¾¹D¬°¤°»ò¡A¤µ¤Ñ¤~³o¼Ë ~
¥L³ºµM¥X²{©³¤Uµøµ¡µLªk¶Ç°e¡A½Ð¦U¦ìÀ°¦£¤@¤U
·PÁÂ


µ{¦¡½X:
Public Declare PtrSafe Function SetTimer Lib "user32" _
        (ByVal hwnd As Long, ByVal nIDEvent As Long, _
        ByVal uElapse As Long, ByVal lpTimerfunc As Long) As Long
Public Declare PtrSafe Function KillTimer Lib "user32" _
        (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)



Function WinProcA(ByVal hwnd As Long, ByVal uMsg As Long, _
        ByVal idEvent As Long, ByVal SysTime As Long) As Long
    KillTimer 0, idEvent
    DoEvents
    Sleep 100
    '¨Ï¥Î Alt + s Áä¨Ó¶Ç°e¶l¥ó
    Application.SendKeys "%s"
End Function
Sub Mail()
    Dim objOL As Object
    Dim itmNewMail As Object
    ¦¬¥óªÌ = Worksheets("¨ÑÀ³°Ó¥]§÷").Cells(1, 50)
    °Æ¥» = Worksheets("¨ÑÀ³°Ó¥]§÷").Cells(2, 50)
    '¥ý¦sÀÉ
    ThisWorkbook.Save
    '¤Þ¥ÎMicrosoft Outlook ª«¥ó¼Ò«¬
    Set objOL = CreateObject("Outlook.Application")
    Set itmNewMail = objOL.CreateItem(olMailItem)
    With itmNewMail
        .Subject = "¡i¨C¤é¡j" & "CORE¬[¥x¶i¾P¦s_" & DateTime.Date '¥D¦®
        .Body = DateTime.Date & " CORE¬[¥x¶i¾P¦s       ¸ÓÀÉ®×·|©ó¨C¤é¤U¯Z«e°e¥X"   '¥»¤å
        .To = ¦¬¥óªÌ    '¦¬¥óªÌ"
        .cc = °Æ¥»
        '.BCC = "yifan"
        '«ü©wªþ¥óªº¸ô®|
        .Attachments.Add ThisWorkbook.FullName
        .Display  '±Ò°Êµøµ¡
        SetTimer 0, 0, 0, AddressOf WinProcA
    End With
    Set objOL = Nothing
    Set itmNewMail = Nothing
End Sub

¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C

TOP

[µo°Ý] VBAµomail²§±` x32

¦U¦ì¡A½ÐÀ°¦£¸Ñ´b¤@¤U ~
¨Ï¥Îx32¨t²Îµo°e®É¡AA¹q¸£¥i¥H B¹q¸£«o¤£¦æ¡A¥X²{©³¤U²§±`µe­±~~
¬°¤°»òªü !?

µ{¦¡½X:
Public Declare PtrSafe Function SetTimer Lib "user32" _
        (ByVal hwnd As Long, ByVal nIDEvent As Long, _
        ByVal uElapse As Long, ByVal lpTimerfunc As Long) As Long
Public Declare PtrSafe Function KillTimer Lib "user32" _
        (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)



Function WinProcA(ByVal hwnd As Long, ByVal uMsg As Long, _
        ByVal idEvent As Long, ByVal SysTime As Long) As Long
    KillTimer 0, idEvent
    DoEvents
    Sleep 100
    '¨Ï¥Î Alt + s Áä¨Ó¶Ç°e¶l¥ó
    Application.SendKeys "%s"
End Function
Sub Mail()
    Dim objOL As Object
    Dim itmNewMail As Object
    ¦¬¥óªÌ = Worksheets("¨ÑÀ³°Ó¥]§÷").Cells(1, 50)
    °Æ¥» = Worksheets("¨ÑÀ³°Ó¥]§÷").Cells(2, 50)
    '¥ý¦sÀÉ
    ThisWorkbook.Save
    '¤Þ¥ÎMicrosoft Outlook ª«¥ó¼Ò«¬
    Set objOL = CreateObject("Outlook.Application")
    Set itmNewMail = objOL.CreateItem(olMailItem)
    With itmNewMail
        .Subject = "¡i¨C¤é¡j" & "CORE¬[¥x¶i¾P¦s_" & DateTime.Date '¥D¦®
        .Body = DateTime.Date & " CORE¬[¥x¶i¾P¦s       ¸ÓÀÉ®×·|©ó¨C¤é¤U¯Z«e°e¥X"   '¥»¤å
        .To = ¦¬¥óªÌ    '¦¬¥óªÌ"
        .cc = °Æ¥»
        '.BCC = "yifan"
        '«ü©wªþ¥óªº¸ô®|
        .Attachments.Add ThisWorkbook.FullName
        .Display  '±Ò°Êµøµ¡
        SetTimer 0, 0, 0, AddressOf WinProcA
    End With
    Set objOL = Nothing
    Set itmNewMail = Nothing
End Sub

¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C

        ÀR«ä¦Û¦b : ºÉ¦h¤Ö¥»¥÷¡A´N±o¦h¤Ö¥»¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD