Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1630
  • Last Modified:

Launch IE browser with website in Outlook Appointment

I am looking for a way for outlook to automatically launch a website from an appointment set in the outlook calendar.
Thank You
  • 5
  • 4
1 Solution
David LeeCommented:
Hi LC7Web,
> launch a website

I'm not clear on what you mean.  Do you mean a link in the appointment that the user will click on, or do you mean that when the appointment time hits you want the appointment to open the web site, or perhaps that you want the website to open any time the user opens the appointment?

LC7WebAuthor Commented:

Sorry for confusion:

when the appointment time hits you want the appointment to open the web site

Thank You
David LeeCommented:

No problem.  Ok, I've got the basic concept working.  I need two more pieces of information. First, we have to have a way of differentiating appointments that open a web site from those that don't.  What do you want to use to control this?  Right now I'm using a Category.  But we could key on something else so long as we can use it consistently.  Second, do appointments meeting the criteria all open the same web site, or would some appointments open one site and others open another?  If the latter, then where do you want to store the web site address the appointment will open?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LC7WebAuthor Commented:
A category is fine.

Appointments meeting the criteria open diffrent websites.

For exmaple, at 9:00 am i want to launch the website www.newday.com, so i can read the mornings news.

Then at 12:00 launch a diffrent site.


I dont know where to store them?
David LeeCommented:
Since they aren't actual meetings, would it be okay to use the Location field?
LC7WebAuthor Commented:
Sure, thats great!
David LeeCommented:
Ok, Lou, here it is.  Here's what you need to do to use it.
1.  Open Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already exapnded, expand Microsoft Outlook Objects and click on ThisOutlookSession
4.  Copy the code below and paste it into the right-hand pane of the VB Editor
5.  Edit the code as necessary.  I included comments where things can/need to be changed
6.  Click the diskette icon on the toolbar to save the changes we've made
7.  Close the VB Editor
8.  Click Tools->Macro->Security
9.  Set the Security Level to medium or follow the instructions from this page (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_dsvba.asp) to sign the macro code
10.  Exit Outlook
11.  Start Outlook
12.  If you opted to set the security level down instead of signing the code, then a dialog-box will pop up saying that ThisOutlookSession contains a macro and asking if you want to allow it to run.  Say yes.
13.  Create an appointment
14.  In the Location field type the url of the web site you want to open.  It must be a complete url (i.e. http://www.somesite.com)
15.  In the Categories field enter LaunchWeb, all one word entered exactly as I typed it here
16.  Set the Start Time to the time you want to trigger on
17.  Check Reminder and set the interval to 2 minute
18.  Save the appointment and you're ready to go

How this works
1.  The macro monitors reminder events (this is all we have since there is no event I know of that's fired when the appointment comes due).
2.  When a reminder fires (lots of things can trigger a reminder), the code checks to see if the reminder is for an Appointment.  If it is, then it next checks to see if the time right now is within 2 minutes (you can adjust this if you want) of the appointment's start time.  If it is, then the final check is to see if the appointment category equals the triggering category (we do this to avoid triggering this macro on real appointments).  If it is, then the macro launches the url in the Location field.  If any of the conditions listed are false, then nothing happens at all.

Reminders don't fire exactly on time.  Sometimes they fire very close to when they should, other times it may be several minutes after when they should have fired that they actually fire.  I suspect it has something to do with how busy both Outlook and the computer are when the reminder comes due.  I've set the macro to fire within 2 minutes of the starting time of the appointment.  If you set the reminder time in your appointments to 2 minutes, as I suggested above, then the reminder will likely fire and the web site appear within 2 minutes of the time specified.  You can play with adjusting that if you want.

That's it.  Give it a try and let me know if you have questions or run into problems.

'Macro begins here
Public WithEvents objReminders As Outlook.Reminders, _
    WithEvents objCalendarItems As Outlook.Items

Private Sub Application_Startup()
    Dim objNS As NameSpace
    Set objNS = Application.GetNamespace("MAPI")
    ' instantiate Items collections for folders we want to monitor
    Set objInboxItems = objNS.GetDefaultFolder(olFolderCalendar).Items
    Set objNS = Nothing
    Set objReminders = Application.Reminders
End Sub

Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
    Dim objShell As Object, _
        objAppointment As Object
    Set objShell = CreateObject("Wscript.Shell")
    If ReminderObject.Item.Class = olAppointment Then
        Set objAppointment = ReminderObject.Item
        'Change the start interval on the next line as desired.  The interval is in minutes.
        If DateDiff("n", Now, objAppointment.Start) <= 2 Then
            'Change the triggering category name on the next line as desired.
            If objAppointment.Categories = "LaunchWeb" Then
                objShell.Run objAppointment.Location
            End If
        End If
    End If
    Set objAppointment = Nothing
    Set objShell = Nothing
End Sub
'Macro ends here
LC7WebAuthor Commented:
Excellent work thanks a lot!
David LeeCommented:
No problem.  Happy to help out.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now