mdmackillop
03-26-2008, 11:24 AM
I'm saving attachments to a folder and want to add a hyperlink to the email which will then be saved in pdf format. This is my code to create the hyperlink (the Else option is used)
Function AddFileSave(strCopiedFiles As String, objMsg As Outlook.MailItem, strfile As String)
'write the save as path to a string to add to the message
'check for html and use html tags in link
If objMsg.BodyFormat <> olFormatHTML Then
AddFileSave = strCopiedFiles & vbCrLf & "<file://" & strfile & ">"
Else
AddFileSave = strCopiedFiles & "<br>" & "<a " & strfile & "'>" & strfile & "</a>"
End If
End Function
and is written to the Body
If lngCount > 0 Then
If objMsg.BodyFormat <> olFormatHTML Then
objMsg.Body = objMsg.Body & vbCrLf & _
"The file(s) were saved to " & strCopiedFiles
Else
objMsg.HTMLBody = objMsg.HTMLBody & "<p>" & _
"The file(s) were saved to " & strCopiedFiles
End If
objMsg.Save
End If
to give this output, but no hyperlink. What am I missing? :banghead:
The file(s) were saved to
M:\1628 SEPA Aberdeen Alterations\Attachments\080228 - 08-02-26 Sinclair Road Interim Certificate no 1-7.pdf (http://vbaexpress.com/forum/)
Function AddFileSave(strCopiedFiles As String, objMsg As Outlook.MailItem, strfile As String)
'write the save as path to a string to add to the message
'check for html and use html tags in link
If objMsg.BodyFormat <> olFormatHTML Then
AddFileSave = strCopiedFiles & vbCrLf & "<file://" & strfile & ">"
Else
AddFileSave = strCopiedFiles & "<br>" & "<a " & strfile & "'>" & strfile & "</a>"
End If
End Function
and is written to the Body
If lngCount > 0 Then
If objMsg.BodyFormat <> olFormatHTML Then
objMsg.Body = objMsg.Body & vbCrLf & _
"The file(s) were saved to " & strCopiedFiles
Else
objMsg.HTMLBody = objMsg.HTMLBody & "<p>" & _
"The file(s) were saved to " & strCopiedFiles
End If
objMsg.Save
End If
to give this output, but no hyperlink. What am I missing? :banghead:
The file(s) were saved to
M:\1628 SEPA Aberdeen Alterations\Attachments\080228 - 08-02-26 Sinclair Road Interim Certificate no 1-7.pdf (http://vbaexpress.com/forum/)