Dear colleagues
I have a code snippet embedded in a Form Command Button as follows:
The code works fine if Me.File1.Value is a Text String. However, I have inherited a form in which the file names are hyperlinks, and I do not have the luxury of changing them to text within the form. Can this be accomplished with VBA? I was wondering if InStr was part of the solution.
Thanks for any assitsance.
FF
I have a code snippet embedded in a Form Command Button as follows:
Code:
Private Sub SendMail_Click()
Dim OutApp As Object, OutMail As Object
Dim MyTo As String, MyFile As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
MyTo = Me.Address.Value
MyFile = Me.File1.Value
With OutMail
.To = MyTo
.Subject = "Test Attachment"
.Body = "Message Body"
.Attachments.Add (MyFile)
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
The code works fine if Me.File1.Value is a Text String. However, I have inherited a form in which the file names are hyperlinks, and I do not have the luxury of changing them to text within the form. Can this be accomplished with VBA? I was wondering if InStr was part of the solution.
Thanks for any assitsance.
FF