如何通过Excel VBA和Outlook实现自动发送邮件功能
1个回答
展开全部
可以直接使用API函数ShellExecute
复制下面的代码,直接粘贴到你的代码模块中,然后运行EmailSend即可看到效果。
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub EmailSend()
Dim receiver$, MyMail$, MySubject$
receiver = "1234567@qq.com"
MySubject = "试试看"
MyMail = "mailto:" & receiver & "?subject=" & MySubject & "&body=Linie:这是一个测试"
ShellExecute 0&, vbNullString, MyMail, vbNullString, vbNullString, 1
End Sub
复制下面的代码,直接粘贴到你的代码模块中,然后运行EmailSend即可看到效果。
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub EmailSend()
Dim receiver$, MyMail$, MySubject$
receiver = "1234567@qq.com"
MySubject = "试试看"
MyMail = "mailto:" & receiver & "?subject=" & MySubject & "&body=Linie:这是一个测试"
ShellExecute 0&, vbNullString, MyMail, vbNullString, vbNullString, 1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询