Sorry I'm having trouble understanding, but so you want to send an email through VB or just open outlook.
If all you want to do is open the outlook program than this will do it.
[tt]
SHELL("Outlook.exe"
[/tt]
If you want to send an email, then check in the FAQ's there are a lot of helpful hints in there. Craig, mailto:sander@cogeco.ca
The following may help with your question though includes references to controls on other form for the attachemnts. Hope this helps.
Option Explicit
Public OlApp As Outlook.Application
Public eMsg As Outlook.MailItem
Public Function fncSendeMail(strSubject As String, strMsg As String, strTo As String, _
Optional ctlAttach As ListBox, Optional strCCTo As String = vbNullString, _
Optional yesDraft As Boolean = True, Optional SendTime As Date)
On Error GoTo errHandler
Dim strMsgID As String
Dim strMsgConf As String
Dim i As Long
Set OlApp = CreateObject("Outlook.Application"
Set eMsg = OlApp.CreateItem(olMailItem)
If ctlAttach.ListCount > 0 And Len(strMsg) > 0 Then
'The vbCr additions to the strMsg ensure that the
'attachments follow the message on a visibly new line
eMsg.Body = strMsg & vbCr & vbCr
Else
eMsg.Body = strMsg
End If
For i = 0 To ctlAttach.ListCount - 1
' Embed a file into the new message
'Constant Value Behavior
'--------------------------------------------------------
'olByValue 1 Creates embedded attachment
'olByReference 4 Creates shortcut to attachment
'olEmbeddedItem 5 Creates shortcut to attachment
'olOLE 6 Creates shortcut to attachment
eMsg.Attachments.Add (ctlAttach.List(i)), olByValue
Next
eMsg.Save
strMsgID = eMsg.EntryID
If Not yesDraft Then 'If false, message will appear in Draft, otherwise in Outbox
eMsg.Send
strMsgConf = "Message has been posted into Outlook's Outbox." & vbCr & vbCr _
& "Delivery of internet eMail will commence when" & vbCr _
& "next online."
Else
strMsgConf = "Message has been posted into Outlook's draft folder." & vbCr & vbCr _
& "Delivery of draft mail will commence only when items" & vbCr _
& "are specifically sent from within Outlook."
End If
Set eMsg = Nothing
Set OlApp = Nothing
Set olAttachment = Nothing
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.