Hello all,
I need your help in accomplishing the following thing:
- i want to be able to paste a recordset in an existing(opened e-mail)
Right now i have some code that accplishes a part of this - i paste the recordset to the "To:" of an e-mail that is created.
I want to open an e-mail (have it in reply mode) and the code paste my recordset to this already opened e-mail and not creating a new outlook message with the to and cc mentioned by the record set.
Find below the code that I have right now ( working,tested):
Thank you all for your help and replies.
Ps: the recordset part if someone is interested :
I need your help in accomplishing the following thing:
- i want to be able to paste a recordset in an existing(opened e-mail)
Right now i have some code that accplishes a part of this - i paste the recordset to the "To:" of an e-mail that is created.
I want to open an e-mail (have it in reply mode) and the code paste my recordset to this already opened e-mail and not creating a new outlook message with the to and cc mentioned by the record set.
Find below the code that I have right now ( working,tested):
Code:
Dim objOutlook As Object 'Outlook.Application (Note dimensioned as Object)
Dim objEmail As Object 'Outlook.MailItem (Note dimensioned as Object)
Dim objNameSpace As Object 'Outlook.NameSpace (Note dimensioned as Object)
Const olMailItem As Long = 0 'For Late Binding
Const olFolderInbox As Long = 6 'For Late Binding
Const olFormatHTML As Long = 2 'For Late Binding
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0 'Resume error trapping ASAP
If objOutlook Is Nothing Then
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
objNameSpace.GetDefaultFolder(olFolderInbox).Display
End If
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = Email
.CC = "me;" & ccmail
.Subject = " "
.Display
End With
Thank you all for your help and replies.
Ps: the recordset part if someone is interested :
Dim Email As String
Dim ccmail As String
'Email = Me!Text34
Dim rst As DAO.Recordset
Dim rst2 As DAO.Recordset
Dim db As DAO.Database
Dim strString As String
Dim strString2 As String
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT mail FROM t1;")
Set rst2 = db.OpenRecordset("SELECT e_mail FROM t2;")
With rst
Do Until .EOF
strString = strString & ![mail]
.MoveNext
Loop
End With
With rst2
Do Until .EOF
strString2 = strString2 & ![e_mail]
.MoveNext
Loop
End With
Email = strString
ccmail = strString2
rst.Close