Modules & VBA :: Body Of Outlook Email - Left Justify String
Mar 5, 2015
I have the following string of text that I currently push out to the body of an Outlook email (using the DoCmd.SendObject function with an Access report):
Code:
sMsgBody = "Please find attached the specified Final Costing Report for WO# " & WO & vbCr & vbCr
sMsgBody = sMsgBody & "Dealer: " & rs.Fields(0).Value & vbCr
sMsgBody = sMsgBody & "Model: " & rs.Fields(1).Value & " : " & rs.Fields(2).Value & " : " & rs.Fields(3).Value & " : " & rs.Fields(4).Value & vbCr
sMsgBody = sMsgBody & "Margin $: " & rs.Fields(5).Value & vbCr
sMsgBody = sMsgBody & "Margin %: " & rs.Fields(6).Value & vbCr
Which is great and works fine! It appears in the email like so:
Original.PNG
Now, it has been requested that the data to be left justified to the widest line... so, in this scenario, it would look like this:
Edit.PNG
I've searched for ways this might be accomplished so it's always left justified to the widest line, but haven't come across any definitive solutions yet.
View Replies
ADVERTISEMENT
Apr 25, 2015
I am trying to fetch combobox dropdown text (in the networks label ) into the email body but in vain.
Whichever networks are selected in the six dropdowns should go to email body as you can find in the attachment ...
View 1 Replies
View Related
Feb 13, 2012
I have a query where I collect data for different vendors and their purchase orders, products deadlines etc.
Is it possible via access to generate a report and via outlook send in the email body a message where is showing the purchase order date of delivery and priority? Or can that be done via a form?
View 6 Replies
View Related
Apr 26, 2015
I am trying to fetch combobox dropdown text (in the networks label ) into the email body but in vain.
Me.cmb_Network_1_data.Text is giving the RowID instead of the text inside the combobox.
Whichever networks are selected in the six dropdowns should go to email body as you can find in the attachement
Code:
Sub update()
Dim oOutlook As Outlook.Application
Dim oEmailitem As MailItem
[Code]....
View 2 Replies
View Related
Aug 5, 2014
I have copied a VBA from the net and it is working fine and producing my report on outlook body text but one problem me facing is that it is pasting only first page if the second page is there it is not coming in outlook text body this what i want rest every thing is correct the code is:
Private Sub Command88_Click()
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f
Dim RTFBody, strTo
Dim MyApp As New Outlook.Application
Dim MyItem As Outlook.MailItem
[Code] .....
View 5 Replies
View Related
Jan 30, 2014
I have a query table in Access 2007 with requests pending an individuals review and approval. I would like to create an automatic email each day to that individual which includes the actual query table impeded as part of the body of the email (not as an attachment).
View 1 Replies
View Related
Apr 22, 2015
I'm trying to put multiple records of data from a subform in a single e-mail, and my Outlook calendar. I have a contracting business, and on my Orders form (which details a single client), I have a sub-form that lists all the items to be done at that client's home (a different record for each work item). When I send an e-mail, or post the appointment to the Outlook calendar, I am trying to list all those records in the body of the e-mail, and/or in the Notes section of the appointment. I created the query to call the records, but have not figured out a way to use it in the code.
View 14 Replies
View Related
Jan 15, 2015
With the code below , I send the report: “ESERT4H”, in email body. How I could add yet another report on the same body of the email ?
DoCmd.OutputTo acOutputReport, "ESERT4H", "HTML(*.html)", "D:Access empESERT4H.html", False, "", 0, acExportQualityScreen
Dim Out As Outlook.Application
Dim NS As Outlook.NameSpace
Dim Folder As MAPIFolder
Dim Mens As MailItem
[Code] ....
View 7 Replies
View Related
Jul 16, 2014
NameStr As String
I have made a name string
Now I would like to add the nameStr near "Dear " how can i do this?
strbody = "<H3><B>Dear [I want the placed nameStr here] </B></H3>" & _
bodyStr & _
"<br><br><B>Thank you</B>"
View 1 Replies
View Related
Nov 16, 2014
With this very simple command, I have the ability to send emails to several clients, reporting many things, quotations etc.
Private Sub Command84_Click()
DoCmd.SendObject , , , , , , "SOMETHING", [SalesGroupingField] & "" & [1], True, ""
End Sub
Now, i want, on the body of the emai, to display many records, it is from Nothwind, how can i display on the body of the email all records from this report?
View 10 Replies
View Related
Sep 11, 2013
I want to import email data into my access table. The email format is always same and the fields in the email match with the fileds in my table.
View 1 Replies
View Related
Jul 15, 2013
I am attempting to modify some code that is used for reading content in an Outlook mail and need to catch and move the email if certain content is duplicated in the email.
The code reads the email that is in the attached image format:
As seen, this email contains 2 devices, but the Serial No in both is duplicated.
In the code, I need to capture this and rather than reading the contents, I need to just move this email to a separate "Manual" folder to be dealt with separately, so not to write the information to the database.
The current code is as follows:
Option Explicit
Private ns As Outlook.Namespace
Private sEmailAddress As String
Private sPerson As String
Private dReceived As Date
[Code] .....
View 4 Replies
View Related
Sep 9, 2013
I have developed a private sub which automatically creates an email when a button is pushed.
The code is working well, but I need to insert Carriage Returns in the Body Text of the email just before the word "Please" where it appears in two places. Is this possible?
The code for the private sub is below.
Private Sub PublishROI_Click()
On Error GoTo Err_PublishROI_Click
DoCmd.SendObject acSendReport, "PSR_Rcd_of_Investigation_Rpt_Publish", acFormatPDF, Me.txtEmail & ";" & Me.txtRMEmail, Me.StorageEmail, , _
Me.txtPSRNum, _
[Code] ....
View 3 Replies
View Related
May 24, 2014
I have created some code to get the records of a query and it puts them in the body of the email but it doesn't format it well for example the email looks like
James | halliwell | 31
Leanne | smith |27
Alexis | smith |8
I would like it to be in a table is this possible,
Code:
Public Function SendEmail()
Dim MyDB As DAO.Database
Dim rst As DAO.Recordset
Set MyDB = CurrentDb
[Code] .....
View 3 Replies
View Related
Jun 15, 2014
The code works perfectly except that a random "0" appears in the body of the email. How to correct the code to remove this annoying little "0"?
Private Sub Command62_Click()
Dim strSubject As String
strSubject = Me.LoadNo
DoCmd.SendObject _
[Code] .....
View 1 Replies
View Related
Jul 9, 2013
I am sending an email from a button, and it runs a word merge and then attaches that word document and two others two an email. All that works fine, but in the body of the email the carriage return is not working.
I've tried "vbCrLf", "Chr(13)" and "Chr(10)". but none of them are working in this email. I use vbCrLf all of the time in many other emails and it works fine.
Code:
Public Function SendEmailFinancial()
Dim MessageBody, vAttach1, vAttach2, vAttach3, vTo
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
[Code] ...
This is what the email is looking like when it comes out:
Project ID: 2013YG00229 Project Title: Toolbox Talks Construction Safety Guides and Mobile App Program Manager: Shana Peschek I am attaching three (3) forms that are needed in order for the State of Washington to process grant payments for your organization for the purposes of carrying out the activities outlined in your final approved application.
View 1 Replies
View Related
Apr 30, 2015
What I want to do is inset a html file into the body of the email . I have created a publisher file and saved as html ..say
C: estpub1.html
How do I get this in to the body ?
Code to date below (not the tidiest - but it works)
Private Sub Command0_Click()
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim OutApp As Object
Dim OutMail As Object
Dim strAttach1 As String
[Code] ......
View 9 Replies
View Related
Jun 17, 2013
I'm running the following code to generate an email from a report.
Quote:
Function ExportHTML3()
Dim strline, strHTML
Dim OL As Outlook.Application
[Code].....
But I don't really know much VBA and I found that code on the internet, so I can't figure out how it's doing that and if I can stop it. Or is there another way to get the text from the HTML file into the Email body, which brings the bold formatting with it, like the following.
Incident Reference: AA99999
View 4 Replies
View Related
Nov 10, 2014
I have a subform in Continuous Records format (records displayed are determined by controls on the parent). I would like to create a button that prepares an email and copies the contents of that subform in to the body of an email message.
The email. I have a method to create a new email, set To, CC, Subject and even Message Text.
Code:
strTo = txtName
strCC = txtManager
strSubject = "Something"
strMessage = "Hi, please find below list of details from X Y and Z" & vbnewline & vbnewline
That all works. Thats fine
The Records: I have found ways to have them added as an attachment, either the the SendObject and OutputTo method but I would like the list of records to be converted to a text string so I can include it within my strMessage variable, not include it as an attachment.
Code:
strMessage = strMessage & "Subform Records to go here"...
View 7 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
Sep 16, 2013
I want to automate an email to include the senders email addres with some text in the body of the email.
Code:
Private Sub send_mail_Click()
Dim olApp As Object
Dim objMail As Object
On Error Resume Next 'Keep going if there is an error
Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open
[Code] ....
View 3 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