If you need clickable links in a custom form, you can use VBScript code and a Label field or Command buttons to make clickable links.
Note: The Contact form has two hyperlink fields - WebPage and FTPSite. Add them to your custom form from the Field Chooser to a form page.
If you need more than two links, you can use code behind the form page to make a label clickable.
Code behind a Label Control
Believe it or not, a label control on an Outlook form supports a Click event. So, you can put the text for the hyperlink in the control's caption and use code like this to launch the link in the browser when the user clicks the label. You could use a CommandButton control or store the URL in another field, other than the control's caption, or even generate it programmatically.
The code samples below work with your default web browser.
The first hyperlink in this screenshot uses just the label, formatted as a hyperlink. To open the second link, you need to click near Open URL. The URL is editable in the text box.
Sub Label1_Click() strURL = Item.GetInspector.ModifiedFormPages("P.2").Controls("Label1").Caption CreateObject("WScript.Shell").Run(strURL) End Sub
Or skip the controls and just use the URL in the code. The advantage in using the control caption is if you need to change the URL, you only need to edit the caption, not the VBScript.
Sub Label1_Click() CreateObject("WScript.Shell").Run("https://www.slipstick.com/developer/custom-form/create-hyperlink-outlook-form/") End Sub
In this code sample, the label is clicked to open a URL in a text field. This method is useful when you need a different link for each contact. In the Open URL example in my screenshot above, I made the label field large and placed the text box over it. This allows the user to click anywhere near the URL (but not inside the black lines)
Sub Label2_Click() strURL = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1").Value CreateObject("WScript.Shell").Run(strURL) End Sub
You can format the label to show the link as blue and underlined, so users will know to click on it. To use the name of the page in the caption, put the hyperlink in the control's Tag property, changing the code above to use Tag instead of Caption.
The "Click here to open hyperlink" tool tip is in the ControlTipText property (in Advanced Properties).
how can we add custom fields/ custom columns for hyperlinks ???
In the list view of the folder? You can't. You can only add the hyperlinks to the form. Sorry.
there is no "Click here to open hyperlink" in Advanced Properties. for ol2016 format contact field . whether missed out any library ?
please assist
sorry, I wasnt clear - that is where you put a screentip - it can say 'click here' or whatever you want.
Thank you. not sure if you can help, but I'm struggling on how to create new a custom field in a form that allows user to input a website address text that becomes a hotlink upon entry. This would be similar to the website field that outlook already has...where a user enters a website address and it is "clickable". I have a need for multiple user hotlink fields in the form. Thank you!
The steps on this page will do it - you need to use a script and you need to set registry keys to enable it.
BTW - if you only need one more, use the FTP field. Like the Web field, it is hyperlinked automatically.
Hi Diane, please can you also assist me. I am trying to do the exact same as above to create a vba behind the command button in my custom contact form. I copied your code above but it does not seem to work. I changed the caption to Label1 - not too sure how to amend it? Please can you assist. I want to open the following website: http://www.astutefse.com.
I created the command button, clicked on View Code, pasted the following: Sub Label1_Click()
CreateObject("WScript.Shell").Run("https://www.astutefse.com/developer/custom-form/create-hyperlink-outlook-form/")
End Sub
Do I need to change anything else (other than the website address)?
Much appreciated!!
Monica
We solved this elsewhere... for references, the issue was the security setting - needed to set the registry key for the correct form name. The form display name was not the same as the form name.