![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm using Access 2002 and 2010 and have a VBA routine which happily creates multiple emails and dumps them into the client's Drafts folder in Outlook. My theory was that the client should open Outlook and actually check the email before moving it to the Outbox from within Outlook. The client now wants to include a facility to press a button and send the email from the Drafts folder from within Access. Has anyone done something similar? -- Bob Darlington Brisbane |
#3
| |||
| |||
|
|
To the best of my knowledge, you cannot send directly from the Drafts folder. I'm not familiar enough with the Outlook Object Model to know if it is possible to move the email to the Outbox in VBA code, but I imagine it can be done. If the client is not going to inspect the emails first, then there's no reason to put them in Drafts, or you can use the .Display property to show the email. Otherwise, just send them using .Send. |
#4
| |||
| |||
|
|
To the best of my knowledge, you cannot send directly from the Drafts folder. I'm not familiar enough with the Outlook Object Model to know if it is possible to move the email to the Outbox in VBA code, but I imagine it can be done. If the client is not going to inspect the emails first, then there's no reason to put them in Drafts, or you can use the .Display property to show the email. Otherwise, just send them using .Send. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.accessmvp.com http://access.mvps.org Co-author: "Access Solutions", published by Wiley "Bob Darlington" <bob (AT) notheredpcman (DOT) com.au> wrote in message news:4ec5ec9b$0$2444$afc38c87 (AT) news (DOT) optusnet.com.au... I'm using Access 2002 and 2010 and have a VBA routine which happily creates multiple emails and dumps them into the client's Drafts folder in Outlook. My theory was that the client should open Outlook and actually check the email before moving it to the Outbox from within Outlook. The client now wants to include a facility to press a button and send the email from the Drafts folder from within Access. Has anyone done something similar? -- Bob Darlington Brisbane |
#5
| |||
| |||
|
|
On 18/11/2011 10:39:04, "Arvin Meyer" wrote: To the best of my knowledge, you cannot send directly from the Drafts folder. I'm not familiar enough with the Outlook Object Model to know if it is possible to move the email to the Outbox in VBA code, but I imagine it can be done. If the client is not going to inspect the emails first, then there's no reason to put them in Drafts, or you can use the .Display property to show the email. Otherwise, just send them using .Send. Don't know if this will help Function ZZMoveDLs(FromFolder As String, ToFolder As String, ToSavedDistList As Boolean) As Integer '?ZZMoveDls("Yacht Club", "SavedDistributionLists", True) Saves Distribution List '?ZZMoveDls("SavedDistributionLists", "Yacht Club", False) selectively restores Distribution List Dim OlApp As New Outlook.Application Dim OlNS As Outlook.NameSpace Dim OlContacts As Outlook.MAPIFolder Dim OlFromFolder As Outlook.MAPIFolder Dim OlToFolder As Outlook.MAPIFolder Dim OlDL As Outlook.DistListItem Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer SysCmd acSysCmdSetStatus, "Saving Distribution Lists" Set OlNS = OlApp.GetNamespace("MAPI") Set Set OlContacts = OlNS.GetDefaultFolder(Outlook.OlDefaultFolders.olF olderContacts) Set OlFromFolder = ZZFindFolder(FromFolder) If OlFromFolder.Name = "Contacts" Then ' Not found MsgBox "The Address Book " & FromFolder & " can not be found", vbCritical GoTo MoveDls_Exit End If Set OlToFolder = ZZFindFolder(ToFolder) If OlToFolder.Name = "Contacts" Then ' Not found MsgBox MsgBox "The Address Book " & ToFolder & " can not be found", vbCritical GoTo MoveDls_Exit End If j = 1 ' Folders found OK If ToSavedDistList = True Then ' Save Distribution List m = Len(FromFolder) ' len("Yacht Club") For i = OlFromFolder.Items.Count To 1 Step -1 If TypeName(OlFromFolder.Items.Item(i)) = "DistListItem" Then l l = OlFromFolder.Items.Count - i + 1 ' Seems to work backwards k = Len(Str(l)) Set OlDL = OlFromFolder.Items.Item(i) If If Left(OlDL.DLName, 7 + m) <> FromFolder & " Group " Then ' Dont save 'Yacht Club Group' OlFromFolder.Items.Item(i).Move OlToFolder j = j + 1 End If End If Next i Else Else ' Restore distribution list m = Len(ToFolder) ' len("Yacht Club") For i = OlFromFolder.Items.Count To 1 Step -1 l l = OlFromFolder.Items.Count - i + 1 ' Seems to work backwards k = Len(Str(l)) If TypeName(OlFromFolder.Items.Item(i)) = "DistListItem" Then Set OlDL = OlFromFolder.Items.Item(i) If If Left(OlDL.DLName, m + k + 11) <> ToFolder & " Group " & CStr(l) & " to: " Then OlFromFolder.Items.Item(i).Move OlToFolder End If j = j + 1 End If Next i End If MoveDls_Exit: Set OlDL = Nothing Set OlFromFolder = Nothing Set OlNS = Nothing Set OlApp = Nothing ZZMoveDLs = j ' Output SysCmd acSysCmdClearStatus Exit Function MoveDls_Err: MsgBox Err.Description, vbCritical Resume MoveDls_Exit End Function I think this is the relevant line OlFromFolder.Items.Item(i).Move OlToFolder Phil |
![]() |
| Thread Tools | |
| Display Modes | |
| |