none
Outlook 2010 custom forms command button to open webpage RRS feed

  • Question

  • Hello

    I am desperately after some asistance. I have created a custom form and wish to add a command button that when clicked, will open internet explorer and a specific website.

    I have searched high and low on the internet and found numerous forums that state it can be done using a command button or a label or using a script but everything I try seems to fail.

    Please help........................

    Wednesday, February 6, 2013 11:25 AM

Answers

All replies

  • Can you show your code?  Are you using VBScript or a Form Region with C#/VB.NET via a COM Add-in?

    If VBScript, from what I remember VBScript doesn't support launching applications.  You can also try Windows Scripting Host. Regardless, I would recommend migrating to .NET based Form Regions - it's more powerful and you can use the much more flexible .NET WinForm controls.


    Eric Legault MVP (Outlook)
    About me...
    Outlook Appins: Store Social Media fields in your Outlook Contacts!

    Wednesday, February 6, 2013 2:59 PM
    Moderator
  • What about IWshRuntimeLibrary.WshShell.Run()? That works from VBScript code as I recall.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Eric Legault [Outlook MVP]" <=?utf-8?B?RXJpYyBMZWdhdWx0IFtPdXRsb29rIE1WUF0=?=> wrote in message news:a7990226-f879-44f5-b1de-538630c42388...

    Can you show your code?  Are you using VBScript or a Form Region with C#/VB.NET via a COM Add-in?

    If VBScript, from what I remember VBScript doesn't support launching applications.  You can also try Windows Scripting Host. Regardless, I would recommend migrating to .NET based Form Regions - it's more powerful and you can use the much more flexible .NET WinForm controls.


    Eric Legault MVP (Outlook)
    About me...
    Outlook Appins: Store Social Media fields in your Outlook Contacts!


    Ken Slovak MVP - Outlook
    Wednesday, February 6, 2013 5:49 PM
    Moderator
  • Hey Eric, thanks for responding.

    The code is as follows:

    Set objWeb = CreateObject("InternetExplorer.Application")

    objWeb.Navigate2(www.microsoft.com)

    objWeb.Visible = True

    I have a development in the behaviour that I'm seeing. Now when I open the form, it does launch IE but still does nothing when I click the button.

    I only want IE to launch when the button is clicked.
    Thursday, February 7, 2013 10:54 AM
  • Can you show all of the code for your form? Are you handling the Click event for the button?

    Eric Legault MVP (Outlook)
    About me...
    Outlook Appins: Store Social Media fields in your Outlook Contacts!

    Thursday, February 7, 2013 2:42 PM
    Moderator
  • Hi Eric

    That is all the code.

    Friday, February 8, 2013 4:08 PM
  • You need an event handler for the button:

    Sub Button1_Click()

    'Your code here

    End Sub


    Eric Legault MVP (Outlook)
    About me...
    Outlook Appins: Store Social Media fields in your Outlook Contacts!

    Friday, February 8, 2013 6:50 PM
    Moderator