Hyperlink based on a Cell refrence in VBA created email.

offspring668

New Member
Joined
Nov 1, 2008
Messages
11
Hi there
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
Just after some help with the below. I've been searching through the forums for a bit and havent been able to find an answer to my question.
<o:p> </o:p>
The below creates an email with \\test\test hyperlinked.
I want to be able to have the \\test\test bit dependant on a range, so the path is based on what the range is.
<o:p> </o:p>
Hope i've explained that well.
<o:p> </o:p>
Regards
<o:p> </o:p>
<o:p> </o:p>
Code:
Private Sub CommandButton6_Click()
Dim strbody As String
Dim OutApp As Object
Dim OutMail As Object
<o:p> </o:p>
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
<o:p> </o:p>
strbody = "<font face='Arial'font style='font-size:12' color:'#FF009966'>Hello<br>" & _
            " <br>" & _
            "This is a test.<br>" & _
            "Othere tests can be found at the  below links.<br>" & _
            " <br>" & _
                        "<A HREF=""[URL="file://Test/test/"]\\Test\test\[/URL]""> Test link.</A><br>" & _ 'I want to be able to be able to set the second test in this patch as a range.
            " <br>" & _
            " If you have any questions give me a shout.<br>" & _
            " <br>" & _
            " Regards.<br>" & _
            " <br>" & _
            " <br>" & _
            Sheets("DATA").Range("C20").Value & "<br>" & _
               
With OutMail
    .To =test
    .CC = test
    .Subject = "Insight Update" & " - " & Sheets("Menu").Range("J42")
    .HTMLBody = strbody
    .Display
End With
<o:p> </o:p>
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Unload Me
<o:p> </o:p>
End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Can anyboy help with this, still no solution?
If theres a diffrent way of writting the whole command maybe?

Im not sure im stumped.
 
Upvote 0
Sorry i've just check my post again

The bit which has

Code:
[FONT=Arial]      "[/FONT][FONT=Arial][COLOR=#304c6c]\\Test\test\[/COLOR][/FONT][FONT=Arial]""> Test link." & _ 'I want to be able to be able to set the second test in this patch as a range.[/FONT]

Should actually have

"< A HREF=""\\test\test"">test.< / A >" & _

I've had to include some spaces so it appears as it does in VBA

so I want the second "test" directory to = a cell value.
As the directory will change based on the user.

Regerds
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top