Perfect ridders52, you absolute star
Perfect ridders52, you absolute star
Hi ridders52, you are a star for helping me get the logo on the mail body thank you, another one is, in the signatures, i have copied the .docx version of the signatures and saved as rtf and removed the Logo as the logo adds from another location, can i now add the text from the rtf below the logo ?? something like If Left(me.txtCustomer,3) = "thy" Then add path to orders signature below logo end if OR the following, i use tab control and have a hidden textbox called "txtIndexNo" this being the page that you are currently on the tab control, for example index3 is deliveries and index7 is collections so here we go, if me.txtIndexNo = "3" then do the mail, add the logo, add path to dispatch signature, if txtIndexNo = "7" then same again but add text from signature path collections@ , hope this makes sense!!! kind regards
Back in post 13, I wrote:
Using an rtf file for your signature files is more complex than any of these methodsSo if you only have a few signatures to include, I suggest you do one of the following:
a) save a screenshot of each signature as an image file then use my code to include that the the email body
b) save the signatures as html text in your code and include that
c) save the signatures to a table then use a variable or function based on a DLookup to reference them in the code
d) save the signature as 'business cards' and include those
Please could you try one of these instead - probably b or c
If it still fails, could you post a stripped down version of your database & I'll look at it later today - not for a few hours though
Hi ridders, nearly there with signature, i have taken your approach by adding a table and using Dlookup based on a number indexNo text box, the most bizzare issue i am having now in which i have never had by using either Chr(10) or vbNewLine or vbCrlf, my address line is going under the logo in one line instead of a new line, see below, do you know why ?? note ID is a number that would be the same as txtIndexNo on the form, NOTE, I did try Chr(10) & _ Signature below the end of here:align=baseline></P>", still would generate new lines per signature!!!
Dim MyApp As Outlook.Application
Dim MyItem As Outlook.MailItem
Dim BodyMessage, Orders, SigString, Signature As String
Dim MySig As String
Dim EMAdd As String
EMAdd = DLookup("EmailAdd", "tblSignatures", "[IDNumber] = " & Me.txtIndexNo)
Signature = "Unit 123," & Chr(10) & _
"Some Street," & Chr(10) & _
"Somewhere" & Chr(10) & _
"Tel: 1234-56789" & Chr(10) & _
"E-Mail:" & " " & EMAdd
Set MyApp = CreateObject("Outlook.application")
Set MyItem = MyApp.CreateItem(olMailItem)
BodyMessage = "THIS IS A TEST EMAIL FROM DM" & Chr(10) & Chr(10) & _
"<P><img border =0 hspace=0 alt='' src='C:\Users\David\Desktop\DMT\EmailLogo.jpg' align=baseline></P>"
With MyItem
Signature = MyItem.HTMLBody
.To = "dave@dmoses.co.uk"
.Subject = "TEST MAIL FROM DM"
Debug.Print BodyMessage
MyItem.HTMLBody = BodyMessage & vbNewLine & Signature
Debug.Print .HTMLBody
.Display
End With
Hi
You said you are using a DLookup for the signature text but I can't see it.
Why are you hard coding it in your code as Unit 123.... etc.
To get a new line use Chr(13) & Chr(10) .... or vbcrlf or vbnewline should work for plain text
But it's HTML text so I think you need paragraph markers
<p> at start of each line and </p> at the end INSTEAD of vbnewline or equivalent
Can you post a screenshot of the email so I can understand more clearly what you mean
The table consists of an IDNumber field and EmailAdd field, the IDNumber being the same as the txtIndexNo:EMAdd = DLookup("EmailAdd", "tblSignatures", "[IDNumber] = " & Me.txtIndexNo), I decided to get full address via VBA rather than table, the only Dlookup is email address based on IndexNo
Signature = "Unit 123," & Chr(10) & _
"Someplace," & Chr(10) & _
"Somewhere" & Chr(10) & _
"Tel: 1234-56789" & Chr(10) & _
"E-Mail:" & " " & EMAdd
I have quite often used Chr(10) & _ to create a new line, however reading your reply, it's HTML rather than text.
I think the reason hard coding is because every signature will be the same apart from EMAdd Looked up from table
Will post email shortly
Much appreicated
email result from post 20 sorry
See https://www.asciitable.com/The table consists of an IDNumber field and EmailAdd field, the IDNumber being the same as the txtIndexNo:EMAdd = DLookup("EmailAdd", "tblSignatures", "[IDNumber] = " & Me.txtIndexNo), I decided to get full address via VBA rather than table, the only Dlookup is email address based on IndexNo
Signature = "Unit 123," & Chr(10) & _
"Someplace," & Chr(10) & _
"Somewhere" & Chr(10) & _
"Tel: 1234-56789" & Chr(10) & _
"E-Mail:" & " " & EMAdd
I have quite often used Chr(10) & _ to create a new line, however reading your reply, it's HTML rather than text.
I think the reason hard coding is because every signature will be the same apart from EMAdd Looked up from table
Will post email shortly
Much appreicated
Chr(13) is a carriage return = vbCr ; Chr(10) is a line feed = vbLf - combined gives vbCrLf or vbNewLine
BUT not for HTML text ...
Try this:
BTW - you would need that notation in the table as wellCode:Signature = <P>"Unit 123,"</P> <P>"Someplace,"</P> <P>"Somewhere"</P> <P>"Tel: 1234-56789"</P> <P>"E-Mail:" & " " & EMAdd</P>
Comes up compile error as highlighted in red when pasted into code, changed EmailAdd in Signatures Table to <p> orders@dmoses.co.uk </p> still no joy but I think if we correct the compile error it will probably work!
Again much appreciated
OOPS. Sorry. Brain wasn't in gear.
Try this instead - hopefully correct this time!
If that still fails, feel free to upload and I'll look at it tomorrowCode:Signature = "<P>Unit 123,</P>" & _ "<P>Someplace,</P>" & _ "<P>Somewhere</P>" & _ "<P>Tel: 1234-56789"</P> & _ "<P>E-Mail:" & " " & EMAdd</P>"
Hi ridders52, cracked it, I have bypassed the highlighted and slightly changed address line of signature and all works, last thing to do is change the email address to Hyperlink to click and mail, am I better changing the field property in the table from short text to Hyperlink ?
Dim MyApp As Outlook.Application
Dim MyItem As Outlook.MailItem
Dim BodyMessage, Orders, SigString, Signature As String
Dim MySig As String
Dim EMAdd As String
EMAdd = DLookup("EmailAdd", "tblSignatures", "[IDNumber] = " & Me.txtIndexNo)
Signature = "<P>Unit 123,</P>" & Chr(10) & _
"<P>Someplace,</P>" & Chr(10) & _
"<P>Somewhere</P>" & Chr(10) & _
"<P>Tel: 1234-56789</P>" & Chr(10) & _
"E-Mail:" & " " & EMAdd
Set MyApp = CreateObject("Outlook.application")
Set MyItem = MyApp.CreateItem(olMailItem)
BodyMessage = "THIS IS A TEST EMAIL FROM DM" & Chr(10) & Chr(10) & _
"<P><img border =0 hspace=0 alt='' src='C:\Users\David\Desktop\DMT\EmailLogo.jpg' align=baseline></P>"
With MyItem
'Signature = MyItem.HTMLBody
.To = "dave@dmoses.co.uk"
.Subject = "TEST MAIL FROM DM"
Debug.Print BodyMessage
MyItem.HTMLBody = BodyMessage & Chr(10) & _
Signature
Debug.Print .HTMLBody
.Display
End With
My DB at work that I built from scratch, i have a question that you may know the answer, i will do this one in 2 posts, next is brief explanation step of procedure
1 Customer uploads a purchase order onto our server
2 the purchase order is named as SL-123456
3 I have a combo called cboFolder in which after update refreshes another combo called cboViewPO
4 Click on the desired SL- and it adds to Database via a recordset providing we have got a shipment date selected
5 It auto adds to our SL- field exactly as per cboViewPO current name ie: SL-653874
6 I use a form in datasheet view so the new addition appears at the top
7 We fill in all details required from SL-653874
Although these are PDF docs in the cboViewPO, like mentioned, when selected it auto adds a new record and auto adds the SL- number,
Although PDF's are images, is there a method to read data from a PDF document ? so lets say, On PDF doc SL-653874, the Purchase Order is PO-987654, can this be read and added via the recordset ?
I will post x 2 vba's that refreshes the cboFolder (this is to select which folder to view files in cboViewPO)
Thanks again
From post 29, this is cboFolder
Dim fso As Object, flD As Object, Fil As Object
Dim SubFolderName As String
Dim FSOa As Object, flda As Object, Fila As Object
Dim SubFolderNamea As String
Dim i, i2 As Integer
Dim MyFldName As String
If Me.cboShipmentDateIndex1 = "" Then ' this is tab control page 1 hence named as Index1 at the end, going back to email signatures, if index1 is open then adds signature
MsgBox ("You Have Not Selected A Shipment Date" & Chr(10) & Chr(10) & _
"Select A Shipment Date Now !"), vbInformation + vbOKOnly, "NO SHIPMENT DATE"
DoCmd.CancelEvent
Else
If Me.cboFolder = "Manifest PO's" Then
Set fso = CreateObject("Scripting.FileSystemObject")
Me.cboViewPO.RowSource = ""
Me.cboViewPO.Requery
SubFolderName = "T:\CustomerName\Manifest PO's"
Set flD = fso.getfolder(SubFolderName)
For Each Fil In flD.Files
i = i + 1
Me.cboViewPO.AddItem Fil.Name 'added
Next Fil
Me.lblPOs.Caption = i & " " & "CustomerName SL's"
Me.cboViewPO.Requery
If i = "" Then
Me.txtFldQty = "0"
Else
Me.txtFldQty = i
End If
End If
End If