Douglas Post
Registered User.
- Local time
- Yesterday, 23:54
- Joined
- Feb 10, 2012
- Messages
- 22
I have created a bit of code that pulls data from a form and populates an email for use in Outlook. I am down to a few formatting hurdles and am unsure of how to go about it.
The First Issue. My current output looks like this
[FONT="]SHOWING INFORMATION[/FONT][FONT="]
Agent: Some Agent
Office: Some Office
Showing Date: Some Date
Showing Time: Some Times
Occupancy: Vacant[/FONT]
I want the results to be lined up as if I was using a TAB. I know HTML cannot do tabs:
My other issue us that currency fields are being displayed as:
[FONT="]2011 Assessed Value: 65500
When I want them displayed as:
[/FONT][FONT="]2011 Assessed Value: $65,500[/FONT]
My bloated code:
The First Issue. My current output looks like this
[FONT="]SHOWING INFORMATION[/FONT][FONT="]
Agent: Some Agent
Office: Some Office
Showing Date: Some Date
Showing Time: Some Times
Occupancy: Vacant[/FONT]
I want the results to be lined up as if I was using a TAB. I know HTML cannot do tabs:
My other issue us that currency fields are being displayed as:
[FONT="]2011 Assessed Value: 65500
When I want them displayed as:
[/FONT][FONT="]2011 Assessed Value: $65,500[/FONT]
My bloated code:
Code:
Private Sub Send_Info_Click()
Dim OutApp As Object
Dim OutMail As Object
Dim Strbody As String
Dim Strbody2 As String
Dim SigString As String
Dim Signature As String
Dim SendEmail As String 'SendEmail is the hyperlink field containing the email address
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
SendEmail = Left(Me!Email, InStr(1, Me!Email, "#") - 1) 'This removes the #mailto:XXX@XXXXX#
Address = Me!Address
City = Me!City
State = Me!State
Zip = Me!Zip
MLS = Me!MLS
ListingLink = Me!
[Listing Link]
ParcelLink = Me![Parcel Data Link]
Strbody = "<font face=verdana size=2 color=#4F81BD>Dear " & [First Name] & ":" & "<br><br>" & _
"Thank-you for showing my listing located at " & [Address] & ", " & [City] & ", " & [State] & " " & [Zip] & "." & "<br><br>" & _
"In an effort to better educate the Seller on this property's position in the market, please provide showing feedback regarding pricing, condition and further interest." & "<br><br>" & _
"<b><u>SHOWING INFORMATION</u></b>" & _
"<br>Agent: " & [First Name] & " " & [Last Name] & _
"<br>Office: " & [Office Name] & _
"<br>Showing Date: " & [Showing Date] & _
"<br>Showing Time: " & [Showing Time] & _
"<br>Occupancy: " & [Occupancy] & _
"<br><br><b><u>ACCESS INFORMATION</u></b>" & _
"<br>Access Location: " & [Keybox Location] & _
"<br>Access Code: " & [Keybox Code] & _
"<br><br><b><u>PROPERTY INFORMATION</u></b>" & _
"<br>Tax ID# " & [Tax ID] & _
"<br>MLS# " & [MLS] & _
"<br>Address: " & [Address] & ", " & [City] & ", " & [State] & " " & [Zip] & _
"<br>" & [Tax Year] & " Assessed Value: " & [Assessed Value] & _
"<br>" & [Tax Year] & " Taxable Value: " & [Taxable Value] & _
"<br><br>Type: " & [Property Type] & _
"<br>SF: " & [SF] & _
"<br>Acreage: " & [Acreage] & _
"<br>School District: " & [School District] & _
"<br>Government Unit: " & [Government Unit]
Strbody2 = "<br><br><A HREF=" & ParcelLink & ">Link to Parcel Data</A><br><br>" & _
"<A HREF=" & ListingLink & ">Link to Listing</A></font>"
SigString = "C:\Users\Douglas Post\AppData\Roaming\Microsoft\Signatures\Brokerage Activity.htm"
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
On Error Resume Next
With OutMail
.To = SendEmail
.From = "post@theLOcompany.com"
'.CC = ""
'.BCC = ""
.Subject = Address & ", " & City & ", " & State & " " & Zip & " (MLS#" & MLS & ")"
.HTMLBody = Strbody & Strbody2 & "<br><br>" & Signature
'.Attachments.Add ("C:\test.txt")
.Display 'or use .Send if you want to send without preview
'.ReadReceiptRequested = True or False
.Importance = 2 'Importance Level 0=Low,1=Normal,2=High
'.Save
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Function GetBoiler(ByVal sFile As String) As String
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function