Modules & VBA :: Access Email With Embedded Image Using Outlook
Sep 29, 2013
I have code that automatically send emails out from an Access Customer Contacts Database. I am using Access and Outlook 2007 but the code needs to work with later versions of Access and Outlook.
I have very poor knowledge of coding and usually manage to cobble something together from looking at other code on the net but don't understand most of it.
I have the following code which works perfectly except I want to be able to embed an image in the email body (not have the image as an attachment but actually show it in the body of the email).
Most of the code I have found around this topic is too complex for me to understand and utilise within the context of the code I have.
Ideally I want to take the image from an attachment field in a table returned by the "tblMailingList_Query".
Code:
Private Sub Command10_Click()
Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
[Code] .....
View Replies
ADVERTISEMENT
Jun 26, 2013
I'm working on a database for my holiday pictures. The pictures are organized in folders per trip/date/location.
When viewing the data of a particular trip, I want the form to display a random image from the respective folder (path stored in database).
I already found a function to count the files in the folder:
Code:
Function GetFileCount(folderspec As String) As Integer
' Returns a count of files in folderspec, or -1 if folder does not exist
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(folderspec) Then
GetFileCount = fso.GetFolder(folderspec).Files.Count
Else
GetFileCount = -1
End If
End Function
to plug into a "randomizer":
Code:
lngFileCount = GetFileCount(strFOLDER)
Randomize
intRND = 1 + Int(lngFileCount * Rnd())
MsgBox intRND
The thing I can't find is how to reference this nth file (or even if there is a way to directly reference this file).
Is there, or do I have to use some kind of looping?
View 3 Replies
View Related
Oct 15, 2014
I found a code that will go trough an emailbox and export all emails to a table in access. This part is working OK (except the received date). I also wante to show in the table if the email contains an attachment, but that part is not working at all. The project actually is meant to store the emails on a shared drive and attachments and have the emails in Access so I can see them all and recall the one needed.
Code:
Private Sub Command14_Click()
Dim TempRst As DAO.Recordset
Dim rst As DAO.Recordset
[Code].....
View 8 Replies
View Related
Jul 8, 2013
I like to do following task using access VBA:
1. Open outlook.
2. Select word file(with tables and graphics) and insert into new outlook email.
View 1 Replies
View Related
Feb 3, 2015
I'm using an unbound text box and a command button to filter a list of contacts on a continuous form. The continuous form has a query for the record source and the list ends up showing only what is in the strWhere filter
Me.Filter = strWhere
Me.FilterOn = True
Is there a way to have Access 2003 take this filtered list and populate the To: field in Outlook or whatever the default mail client is? Each email needs to be deliminated by ";"
View 5 Replies
View Related
Aug 4, 2014
My company recently upgraded our MS Office from 2007 to 2010 (except for Access).
Previously, when I had Access 2007 and Outlook 2007, I had a process that generated 50+ dynamic emails from an Outlook template file (.oft).
The code would loop through a listbox and replace the template's default text to a string of text specific to the selection in the listbox by utilizing the Replace() function on the MailItem .HTMLBody.
Since the upgrade to Outlook 2010, the code is able to run, however, the Replace() function is no longer working; Instead, each email that is generated maintains the template's default text.
The only thing that is not working is the Replace() function, all other aspects of the code work fine.
I've provided a simplified version of the code below:
Dim myOlApp As Outlook.Application
Dim objMailMessage As MailItem
Dim stBody As String
Set myOlApp = Outlook.Application
Set objMailMessage = myOlApp.CreateItemFromTemplate("C:UsersDesktop emplate.oft")
[Code] .....
I've recreated the template file in Outlook 2010, thinking that the template created with Outlook 2007 would be the culprit, but to no avail.
What could have changed from Outlook 2007 to Outlook 2010 that would render my previously valid code ineffective?
Are there certain references I need to enable in both Access and Outlook to allow VBA in Access modify the content in an Outlook email?
View 12 Replies
View Related
Dec 17, 2013
I'm using ACCESS 2010. I have a form which is having a embedded word document. What I'm trying to do is i want to enable user to format a mail in the embedded word document which will contain rich text and screenshots then with a click of button an outlook mail should open and content of this document should be pasted there. Once user sends this email, I want to save content of embedded document in the database.
View 4 Replies
View Related
Jul 30, 2014
I'm trying to make it so when a subform is updated, it will email the contents of that subform to me. I've got it all working, except for the content of the email part.
Code:
Sub SendRepReassignment()
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
Dim objOutlookAttach As Outlook.Attachment
On Error Resume Next
Err.Clear
[code]...
View 3 Replies
View Related
Jun 16, 2013
I am making a new database. And I want to confirm that I can do all the following in Access 2007 and how is best to do it.
1) A form where I can define:a unique Email Number starting at 1.
a directory eg "C:UsersPaulDesktop101 - Brick House"
an email address.
a Recipient Name
a Category for the email. Choosing either "Working" or "Complete". This would be part of the email subject.
2) a button which onclick lists all the files in the defined directory to a box on the form.
3) a button which onclick exports a report containing the list of files to PDF. Then attaches a zip of these files and the PDF report to an email in Outlook for revision before sending.
4)In Outlook the subject would be:
"The Directory Name" - "The Category" - "The Email Number"
"101 - Brick House - Working - Email 1"
5)In Outlook the body would simply be the subject of the email followed by the filenames of the 2 attached files, ie the PDF report and the zip.
View 7 Replies
View Related
Nov 26, 2013
I am a College Instructor and I would like to make a Database that will regularly email me a list of Students who are approaching the mid-point of their Program.Is it possible to program Access to email a list with Student Names, Registration Numbers, etc, etc. by a given date?
As of right now I have a Database with all of the students' pertinent information but I have to manually comb through the Database each week to see which students will require a Mid-Term interview that week.
View 7 Replies
View Related
Aug 15, 2015
I have been trying to get this to work but without success.
My original source was [URL] ....
The code looks good apart from the fact that the Inspector was not Dimensioned. Anyway, here is my code which fails as the error message is that objSel is not set.
Code:
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItemFromTemplate(DLookup("TemplateFolder", "Company Details") & "eMail Template bm4.oft")
MyMail.To = strTarget
MyMail.Subject = "Test"
[Code] .....
View 1 Replies
View Related
Aug 16, 2014
I have this VBA code:
Option Compare Database
Option Explicit
Private Const URL_CDOCONFIG As String = ""
Public Function SendEmail(ByVal sTo As String, ByVal sFrom As String, _
Optional ByVal sCC As String = "", Optional ByVal sBCC As String = "", _
Optional ByVal sSubject As String = "", Optional ByVal sBody As String = "", _
[Code] ....
It is being called with the following macro:
SendEmail("gregory.west@dbwsys.mb.ca","vba@dbwsys. mb.ca","","","Subject line","Body of eMail here")
But I get this error message.
The "SendUsing" configuration value is invalid.
View 1 Replies
View Related
Feb 3, 2014
I'd like a command button to open Outlook and create a new email message with the To and Subject fields already populated with what I want, is there anyway to do this?
View 1 Replies
View Related
Nov 25, 2013
How I could initiate a search from MS Access on an Outlook folder for an email addresss.
I would like to to work just as if you were using the outlook 'Try searching in All Mail Items'
View 11 Replies
View Related
Jul 23, 2015
What i would like to do is replace the DoCmd.OutputTo line with a DoCmd.SentTo line to email the reports to the appropriate faculty instead of just saving them in the folder.
I used this line but it did not work: DoCmd.SendObject (acSendReport, , acFormatPDF, "vtblfaculty.email&'@xxx.edu'","me@xxx.edu",,"test ","this is a test",-1,,)I have been working on this forever!
Public Sub something3()
Dim db As Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT DISTINCT tblsection.Faculty, left(vtblfaculty.firstname,1)&vtblfaculty.lastname AS fn, vtblfaculty.email FROM vtblfaculty INNER JOIN tblsection ON tblsection.faculty=vtblfaculty.faculty WHERE term=" & Forms!frmimport!cbxTerm)
[code]...
View 6 Replies
View Related
Jun 26, 2014
I would like to create a button that when pressed opens up an outlook email. The email address will be populated by one email address every time. I don't want it to automatically send as the body will need to be filled out by the user. It would be useful if the date and time it was sent could be recorded in the form somewhere too (would this be in a text box?).
View 3 Replies
View Related
Jan 22, 2008
I have a Access training database which tracks employees trainings as well as their annual recertification dates on particular trainings. Is there a way to have an email sent to the employees automatically when their recertification date is 1 month away?
View 3 Replies
View Related
Aug 7, 2006
Hi
I have written a code that composes a new mail from MS Access. It does what i need. It also gives a question before displaying the mail body :
"A program is trying to access e-mail addresses yo have stored in outlook. Do yo want to allow this ?"
If I give yes, it proceeds with composition. If I give No, it gives an error "Application-defined or object defined error". Is there any way I can avoid this error.
Thanks
View 2 Replies
View Related
Dec 3, 2013
I'm trying to see if can search outlook exchange from access vba to get email address (using windows user name) .
View 1 Replies
View Related
Aug 27, 2014
I'm trying to write a line of VBA code (in an existing Access 2010 DB) that changes the Subject Line of all selected emails in my Outlook Inbox to today's date.
View 1 Replies
View Related
May 2, 2014
I have vba code set up to automate a query output to email with outlook. I am having issues with the "TO" field. I have tried different types of code, such as the following:
1) MyMail.To = MailList.Fields("EmailAddress")
2) MyMail.To = MailList.Fields("EmailAddress") & ";"
Both of these work, but the issue I am having is the "TO" field in the outlook message looks like this:
admin@blahblah#mailto:admin@blahblah#
Why my code is adding the email address twice, I need to get rid of the #mailto:admin@blahblah# but I do not know how or why it keeps adding that end part.
View 3 Replies
View Related
Aug 6, 2015
I am currently in the process of creating a form that will allow you to enter details for an email sent, select a number of documents from a list box and then open the mail message pre-written with attachments. The attachments reside in a list box currently, and I am attempting to use a "For Each" with item selected.column(3) as the file path, as column(3) contains the filepath from the table.
Currently my code is:
Private Sub OutlookBut_Click()
Dim olApp As Object
Dim objMail As Object
Dim varItm As Variant
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
[Code] ....
When this code runs, outlook will open as a process when it is closed, but then freeze and not allow me to see it or access it in anyway. If Outlook is opened Microsoft office usually gets angry at me and decides to throw error messages at me.
View 2 Replies
View Related
Mar 20, 2014
i'm trying to send an Outlook e-mail from Access. Everything works fine except for one thing:
When generating the HTMLBody I use vbNewLine for starting a new line in the string that works fine as long as being in Access. However after displaying it in Outlook there are no any new lines in the mail text; the complete text is one mass.
I tried to use Chr(13) but had the same result.
View 2 Replies
View Related
Aug 27, 2014
I have access db sending report with outlook every Monday.
But the problem is if outlook is open when I start the db, email goes in to outgoing folder and msg box of outlook opens saying " outlook will close after countdown if I do not hit the "DO NOT EXIT" button or "EXIT AND SEND LATER" button.
If I hit "EXIT AND SEND LATER" button, it sends next time I open the outlook.
Is it possible to prevent outlook doing this?
View 14 Replies
View Related
Sep 11, 2014
I wrote VBA code to pull email messages from Outlook in order to create an alert if a message with a specific subject line is not received. I have the system coded to send the alert if the message isn't found before the system encounters a message with a SentOn date/time more than two hours old.
The code has worked great for over a year, but now my company is migrating to Win8 and I'm having issues with the code. The machine that normally runs the process uses XP and Access 2007. The code also works on another machine running Windows 7 and Access 2010.
The issue I'm having in Win8, with Access 2010, is that the code isn't pulling the most recent message first. Instead, it is selecting a message from about two weeks ago, and then cycling through the other messages from that point. I know there are ways I can code around this, but I don't want to if I don't have to.
Is there a setting that I'm missing? I've included the basic code to pull the email messages below:
Code:
DoCmd.SetWarnings False
Dim ol As Outlook.Application
Dim ns As Namespace
Dim Inbox As MAPIFolder
Dim Item As Object
Dim strSubject, strSentDate As String
[Code] .....
View 3 Replies
View Related
Apr 29, 2005
I have code to open a new email and populate the BCC field. My problem is the company usually uses a template for all emails they send, from access how to I het outlook to use the the usually template?
Thanks
Paul
View 4 Replies
View Related