附件名称须要加引号: 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 Command1_Click() ShellExecute Me.hwnd, "", "mailto:[email protected]?subject=hello&body=student&attachment= ""c:\temp.htm""", "", "", 0 End Sub
(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然后使用类似这样的语句:
ShellExecute Me.hwnd, vbNullString, "mailto:yourmail", vbNullString, vbNullString, 0&或者可以用更简单的方法:
shell "start.exe mailto:yourmail",vbNormalFocusCheers?
我试过了,没有问题的
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 Command1_Click()
ShellExecute Me.hwnd, "", "mailto:[email protected]?subject=hello&body=student&attachment= ""c:\temp.htm""", "", "", 0
End Sub