locked
Internet Explorer 8 - Container.Application.GoBack when there is no previous page RRS feed

  • Question

  • How to use Container.Application.GoBack when there is no previous page in Internet Explorer 8.
    The issue is in Internet Explorer 8 with GoBack when there is no Previous page in the browser.

    Hi
    I have an Excel 2003 workbook opened in Internet Explorer.
    The following code, attached to a button,
    is intended to "GoBack" in the browser and then exit Excel.

    This did work in previous versions of IE,
    but in IE8 there are 2 issues:
    1. an error is displayed if there is no previous page in the browser
    2. the EXCEL.EXE process is not killed (in Windows Task Manager).

    Any help would be greatly appreciated.

    [code]

    Public Sub Button1_click()
    On Error GoTo errHandler
        ThisWorkbook.Container.Application.GoBack
        ThisWorkbook.Application.Quit
        ThisWorkbook.Close
    exitHandler:
        Exit Sub
    errHandler:
        Select Case Err.Number
        Case 1004           ' Container does not exist
            Resume Next
        Case -2147467259    ' Method GoBack notfound
            Resume Next
        Case Else
            MsgBox Err.Number & ": " & Err.Description 
        End Select
        GoTo exitHandler
    End Sub

    [/code]

    Monday, December 12, 2011 8:31 PM

Answers