• Opening URL in default browser (Excel 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Opening URL in default browser (Excel 2003)

    Author
    Topic
    #438556

    I’m trying to write a function of the form MyOpenURL(URL,Arg1,Arg2) that would open the nominated URL with the default browser in a new window and return TRUE or FALSE depending on success or otherwise. I’d be grateful if someone could help with the key lines of Code. I’ve tried “ActiveWorkbook.FollowHyperlink etc” with no success. I’m rather lost. My Visual Basic experience is quite limited.

    regards

    Geoffrey Howell

    Viewing 0 reply threads
    Author
    Replies
    • #1046020

      I don’t know how to return a boolean specifying whether the URL could be opened if you don’t know the browser. The ShellExecute API function will try to open an URL in the default browser, but the return value only indicates whether the browser could be started, not whether the URL could be opened. ActiveWorkbook.FollowHyperlink doesn’t return a value at all, but it does use the default browser and it has an argument that lets you specify that the link should be opened in a new window…

      • #1046023

        Hans, Thank you. I’ve tried the following line:

        ActiveSheet.FollowHyperlink Address:= “http://www.google.com.au/”, NewWindow:= True

        and I can use error control to determine if it works or not. But I can’t get that line to work, though it works if I open a file within my computer. I assume I’m doing something wrong. Do you have any thoughts?

        regards

        Geoffrey

    Viewing 0 reply threads
    Reply To: Opening URL in default browser (Excel 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: