How often are you in Outlook and you receive an e-mail from someone and you want to know a little bit more about them. It may be as simple as looking up their phone number so that you can get back to them.
This lookup may be on your own intranet site or using LinkedIn, Facebook or Twiter.
The following Outlook macro will allow you to do this.
This first function will allow you to open Internet Explorer with the URL that you pass to it:
Private Sub NavigateToURL(ByVal argURL As String)
Const READYSTATE_COMPLETE = 4
Dim objIE As Object
Set objIE = CreateObject("InternetExplorer.Application")
.Visible = True
Do Until .readystate = READYSTATE_COMPLETE
Set objIE = Nothing
Now we have to find some content to pass to the URL.
Public Sub employeeSearch()
Dim strEmployeeName As String
Dim item As Object
strEmployeeName = ""
If TypeName(Application.ActiveWindow) = "Inspector" Then
Set item = Application.ActiveWindow.CurrentItem
If TypeOf item Is Outlook.ContactItem Then
strEmployeeName = item.FullName
If TypeOf item Is Outlook.MailItem Then
strEmployeeName = item.SenderName
strEmployeeName = InputBox("Enter name", , strEmployeeName)
If strEmployeeName <> "" Then
NavigateToURL "http://colleaguedirectory.intranet.group/Pages/PeopleResults.aspx?k=" & strEmployeeName
If when you call this macro you have either a contact window or an email open the macro will grab the full name of the contact or the sender name of the email. Irrespective it will then display a prompt window with the obtained username which you can then amend or accept.
Confirming the dialogue will then open the requested search URL with the name appended.
This works best by adding a macro button to the toolbar that calls this function.
I have included the URL for my work’s internal directory, if you want to search some external sites you replace the embedded URL with one of: