不知道是不是你要的代码
'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 LongPrivate Sub SendMail(Optional Address As String, _
Optional Subject As String, Optional Body As String, _
Optional CC As String, Optional BCC As String) Dim strCommand As String
'Build up the mail string
If Len(Subject) Then strCommand = "&Subject=" & Subject
If Len(Body) Then strCommand = strCommand & "&Body=" & Body
If Len(CC) Then strCommand = strCommand & "&CC=" & CC
If Len(BCC) Then strCommand = strCommand & "&BCC=" & BCC
'Replace the first ampersand, if any,
'with a question
If Len(strCommand) Then
Mid(strCommand, 1, 1) = "?"
End If
'Add mailto: command and main e-mail
'address to the command string
strCommand = "mailto:" & Address & strCommand
'Execute command via the API
Call ShellExecute(Form1.hwnd, "open", strCommand, _
vbNullString, vbNullString, SW_SHOWNORMAL)End SubPrivate Sub Command1_Click()
Dim aaa As String
Dim bbb As String
Dim ccc As String
Dim ddd As String
Dim eee As String
aaa = "aa"
bbb = "bbb"
ccc = "ccc"
ddd = "ddd"
eee = "eee" SendMail aaa, bbb, ccc, ddd, eee
MsgBox aaa
MsgBox bbb
MsgBox ccc
MsgBox ddd
MsgBox eee
MsgBox xx
End Sub
'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 LongPrivate Sub SendMail(Optional Address As String, _
Optional Subject As String, Optional Body As String, _
Optional CC As String, Optional BCC As String) Dim strCommand As String
'Build up the mail string
If Len(Subject) Then strCommand = "&Subject=" & Subject
If Len(Body) Then strCommand = strCommand & "&Body=" & Body
If Len(CC) Then strCommand = strCommand & "&CC=" & CC
If Len(BCC) Then strCommand = strCommand & "&BCC=" & BCC
'Replace the first ampersand, if any,
'with a question
If Len(strCommand) Then
Mid(strCommand, 1, 1) = "?"
End If
'Add mailto: command and main e-mail
'address to the command string
strCommand = "mailto:" & Address & strCommand
'Execute command via the API
Call ShellExecute(Form1.hwnd, "open", strCommand, _
vbNullString, vbNullString, SW_SHOWNORMAL)End SubPrivate Sub Command1_Click()
Dim aaa As String
Dim bbb As String
Dim ccc As String
Dim ddd As String
Dim eee As String
aaa = "aa"
bbb = "bbb"
ccc = "ccc"
ddd = "ddd"
eee = "eee" SendMail aaa, bbb, ccc, ddd, eee
MsgBox aaa
MsgBox bbb
MsgBox ccc
MsgBox ddd
MsgBox eee
MsgBox xx
End Sub
解决方案 »
- 100分winsock传送文件的问题
- 谁有mscomm16.ocx啊
- 我想写一个客户控件,在网页里嵌入一个应用程序,请高手帮忙,在线等.
- 问一个很简单的SQL语句的问题
- CSDN的结贴率太低,好象不是这样的.各位........
- 如何在vb中通过代码实现在SQLServer中新建数据库和在此数据库中新建数据表呢?(紧急求救!!!)
- 如何获取当前控件
- 100分帮忙看一下小问题!!!!是关于读文本文件内容的!!!在线等!立苛给分!
- 怎么得到数组的元素数?
- 解释一下recordset对象的几个属性设置的意思
- 今天多了一个小妹,可她远在河南……送她什么好呢?在网上,有不能电子商务,献策:)
- Shell_NotifyIcon函数的一个问题
用OE的我还不知道。