Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email body text

Status
Not open for further replies.

smiley0q0

Technical User
Feb 27, 2001
356
US
i am trying to have more than one line in the body of my test i am setting up for. i want some spaces and a hyperlink. or attach a shortcut to the email, whichever is easiest. can some one help me... here is my code that i am working with.

Private Sub CmdSend_Click()
Dim appOut As Outlook.Application
Dim EMailOut As Outlook.MailItem
Dim MthYr As String
Set appOut = CreateObject("Outlook.Application")
Set EMailOut = appOut.CreateItem(olMailItem)
MthYr = Format(txtDate, "mmmm - yyyy")

With EMailOut
.To = "Jared Taylor"
.Subject = "Waved Fees Report for " & MthYr
.Body = "Check It Out X:\assetmgt\Waved Fees.xls "
'.Body = "will a hyperlink fit here?"
.Display
End With

End Sub

Thank you for your help.

Smiley :cool:
 
Outlook recognizes it automatically. Just pass the address in and Outlook will turn it into a hyperlink. Tried it myself.

Private Sub TestEMail()
Dim appOut As Outlook.Application
Dim EMailOut As Outlook.MailItem
Dim MthYr As String
Set appOut = CreateObject("Outlook.Application")
Set EMailOut = appOut.CreateItem(olMailItem)
MthYr = Format(txtDate, "mmmm - yyyy")

With EMailOut
.To = "augerinn@gte.net"
.Subject = "Waved Fees Report for " & MthYr
.BODY = "www.msn.com"
.Display
End With

End Sub
 
yea i got that to work, but lets say that i want several lines of text and then my hyperlink. but i don't neccesarily want my text to go all the way accross, and i also want a line or 2 between my text and the hyperlink. like this...

.To = "whomever"
.Subject = "Whatever"
.Body = "yadda yadda yadda..."
"blank space"
&quot;<\\X:\Reports\My Report.xls\>&quot;

does this make sense?

also i have another question, ... when i start typing &quot;atta&quot;, attachments is listed in the list, but attachment is not, both are in the object browser, how do i get attachment into the list so that i can use it?
 
Use vbNewLine or chr(10) + chr(13) to insert a hard break for your spaces.
Verify that you've set reference to the Outlook object model in your VBA code for the intellisense to work. Also, make sure you've typed the variable name right. I always type my variables in lower case, but declare them with some upper case letters. That way, when Access changes the variable to upper case, I know I've typed the right name in.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top