怎样用excel中的宏定时自动发邮件???求大神指导,先跪谢了
2个回答
展开全部
a.) 打开Excel,新建Book1.xlsx
b.) 填入下面的内容,
第一列:接收人,第二列:邮件标题,第三列:正文,第四列:附件路径
注意:附件路径中可以有中文,但是不能有空格
这里你可以写更多内容,每一行作为一封邮件发出。
注意:邮件正文是黑白文本内容,不支持加粗、字体颜色等。(如果你需要支持彩色的邮件,后面将会给出解决办法)
2.
编写宏发送邮件
a.) Alt + F11 打开宏编辑器,菜单中选:插入->模块
b.) 将下面的代码粘贴到模块代码编辑器中:
Public Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerfunc As Long) As Long
Public Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private Declare 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发送邮件,这是本文的关键之处,免安全提示自动发送邮件全靠它了
b.) 填入下面的内容,
第一列:接收人,第二列:邮件标题,第三列:正文,第四列:附件路径
注意:附件路径中可以有中文,但是不能有空格
这里你可以写更多内容,每一行作为一封邮件发出。
注意:邮件正文是黑白文本内容,不支持加粗、字体颜色等。(如果你需要支持彩色的邮件,后面将会给出解决办法)
2.
编写宏发送邮件
a.) Alt + F11 打开宏编辑器,菜单中选:插入->模块
b.) 将下面的代码粘贴到模块代码编辑器中:
Public Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerfunc As Long) As Long
Public Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Private Declare 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发送邮件,这是本文的关键之处,免安全提示自动发送邮件全靠它了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询