E
Eka1618
Hello,
I am trying to creake a hyperlink in an e-mail message that will open a file
on the users desktop. I need to use an environment variable so that it will
link to the user who opens up the message.
If I leave out the <a href> tag, the string (strPath) displays the path I am
looking for: C:\Documents and Settings\EMM\Desktop|EngFE.accdb
I am not sure why making strPath the link in my hyperlink is causing the
string to change its value. I dont think it is changing value, but when I
receive the e-mail the link is changed to: C:\Documents
Here is my code:
Public Sub conductorEMail(frm As Form)
'Send an e-mail using the outlook application object...
'version 1.0
'1.0: Initial version.
Dim outOutlookInstance As Outlook.Application
Dim maiMessage As MailItem
Dim lngCounter As Long
Dim strArray() As String
Dim emName As String, varItem As Variant
Dim emailBody As String
Dim emailSubject As String
Dim strPath As String
strPath = "C:\Documents and Settings\" & Environ("USERNAME") &
"\Desktop\EngFE.accdb"
On Error GoTo SendEMail_Error
'Create the Outlook instance...
Set outOutlookInstance = CreateObject("Outlook.Application")
emailSubject = "New Test Assigned"
emailBody = "Hello, <br><br>" & _
"The product test request for Request Number: " & "<b><font color =
red>" & frm.REQUEST_NO.Value & "</font></b>" & _
" has been Accepted by the Tech Team Leader. <br><br>" & _
"You have been assigned:<br><br>" & _
"Test Queue # " & " <b><font color = red>" & frm.QID.Value &
"</font></b><br>" & _
"Test Type : " & "<b><font color = red>" & frm.TEST_TYPE.Value &
"</font></b> <br><br>" & _
"Please log into the <a href = " & strPath & ">Product Engineering Test
Database</a> to enter test results once test has been completed.<br><br>" & _
"Thank You!"
'Create the mail message...
Set maiMessage = outOutlookInstance.CreateItem(olMailItem)
With maiMessage
.To = CurrentDb.Properties("ConductorsEmail")
.SentOnBehalfOfName = CurrentDb.Properties("RequesteeEmail")
.Subject = emailSubject
.HTMLBody = "<h2 align = center><b><font color = red>Test Queue
Assigned (Test Conductors Next Action)<align></font></b></h2><br><br>" &
emailBody
'Send the message...
.Send
End With
'Clear the objects...
Set maiMessage = Nothing
Set outOutlookInstance = Nothing
SendEMail_Error:
If Err.Number <> 0 Then
MsgBox Err.Number & ": " & Err.description, vbCritical, "SendEMail"
End If
End Sub
If anyone has any suggestions, please let me know! Thank You!
I am trying to creake a hyperlink in an e-mail message that will open a file
on the users desktop. I need to use an environment variable so that it will
link to the user who opens up the message.
If I leave out the <a href> tag, the string (strPath) displays the path I am
looking for: C:\Documents and Settings\EMM\Desktop|EngFE.accdb
I am not sure why making strPath the link in my hyperlink is causing the
string to change its value. I dont think it is changing value, but when I
receive the e-mail the link is changed to: C:\Documents
Here is my code:
Public Sub conductorEMail(frm As Form)
'Send an e-mail using the outlook application object...
'version 1.0
'1.0: Initial version.
Dim outOutlookInstance As Outlook.Application
Dim maiMessage As MailItem
Dim lngCounter As Long
Dim strArray() As String
Dim emName As String, varItem As Variant
Dim emailBody As String
Dim emailSubject As String
Dim strPath As String
strPath = "C:\Documents and Settings\" & Environ("USERNAME") &
"\Desktop\EngFE.accdb"
On Error GoTo SendEMail_Error
'Create the Outlook instance...
Set outOutlookInstance = CreateObject("Outlook.Application")
emailSubject = "New Test Assigned"
emailBody = "Hello, <br><br>" & _
"The product test request for Request Number: " & "<b><font color =
red>" & frm.REQUEST_NO.Value & "</font></b>" & _
" has been Accepted by the Tech Team Leader. <br><br>" & _
"You have been assigned:<br><br>" & _
"Test Queue # " & " <b><font color = red>" & frm.QID.Value &
"</font></b><br>" & _
"Test Type : " & "<b><font color = red>" & frm.TEST_TYPE.Value &
"</font></b> <br><br>" & _
"Please log into the <a href = " & strPath & ">Product Engineering Test
Database</a> to enter test results once test has been completed.<br><br>" & _
"Thank You!"
'Create the mail message...
Set maiMessage = outOutlookInstance.CreateItem(olMailItem)
With maiMessage
.To = CurrentDb.Properties("ConductorsEmail")
.SentOnBehalfOfName = CurrentDb.Properties("RequesteeEmail")
.Subject = emailSubject
.HTMLBody = "<h2 align = center><b><font color = red>Test Queue
Assigned (Test Conductors Next Action)<align></font></b></h2><br><br>" &
emailBody
'Send the message...
.Send
End With
'Clear the objects...
Set maiMessage = Nothing
Set outOutlookInstance = Nothing
SendEMail_Error:
If Err.Number <> 0 Then
MsgBox Err.Number & ": " & Err.description, vbCritical, "SendEMail"
End If
End Sub
If anyone has any suggestions, please let me know! Thank You!