hi all,

I've got an excel Macro in one of my projects that has to retrieve data from a seperate excel spreadsheet on the web. below is the code I use to extract that data:

Sub CopyWsFromWeb()

    Dim wbkMsg As Workbook
    Dim Wb As Workbook
    Dim Ws As Worksheet
    

    With Application
        ' Turn off screen-updating and disable the canceling the procedure
        ' while the internet connection is being made
        .EnableEvents = False
        .ScreenUpdating = False
        .EnableCancelKey = xlDisabled
        ' save the current state
        Set Wb = .ActiveWorkbook
        Set Ws = .ActiveWorkbook.ActiveSheet
        ' Delete the info if it already exists
        On Error Resume Next
        .DisplayAlerts = False
        .Sheets("Info").Delete
        .DisplayAlerts = True
        On Error GoTo ErrorProcedure
        ' Opens an Excel file on the internet
        Set wbkMsg = Application.Workbooks.Open("http://location-here")
        
        ' Copy the worksheet into the current workbook
        wbkMsg.Worksheets(1).Copy After:=Wb.Worksheets(Wb.Worksheets.Count)
        ' Rename the new worksheet
        ActiveWindow.ActiveSheet.Name = "Info"
        ' Activate the original worksheet
        Ws.Activate
        Sheets("User Information").PopulateDetails
        ' Close the web workbook
        wbkMsg.Close savechanges:=False
        Sheets("Info").Visible = False
        Sheets("Details").Range("sheetDate").Value = Now
        ' re-enable screen update and canceling
        .EnableCancelKey = xlInterrupt
        .ScreenUpdating = True
        .EnableEvents = True
        
    End With
    Exit Sub

ErrorProcedure:
    MsgBox Err.Description
    Application.ScreenUpdating = True
    Application.EnableCancelKey = xlInterrupt
    Application.EnableEvents = True
End Sub
This code works perfectly when it runs in Excel 2003, but when a link to the workbook was put on a webpage, it runs from within an Internet Explorer browser window, and this macro dies with error message "Method 'Open' of object 'Workbooks' failed".

Is this a shortcoming of running Excel from within a browser window? Is there a workaround for this?

thanks for any help you can give