none
How to access or read a file which is located on an external website? RRS feed

  • Question

  • Hi, 

    My Word macro should read an excel file which lies on an external server using an URL such as "http://example.com/directory/subdirectory/file.xls". Whenever I try to read this file, it returns me an error HTML page which reads "You need to have Active Scripting enabled to access the server". 

    But when I manually put the URL into Internet Explorer it returns me a proper normal dialog prompt box (of Internet Explorer) which asks whether I want to Open, Save or Cancel. If I click "Open" it opens the excel file and if I click "Save" it downloads the file. 

    I want my macro to open and read the file using my Word (2007 and 2010) macro. Please help. 

    Thanks. 

    Sunday, September 1, 2013 6:37 PM

Answers

  • Could you share the code here?

    I can access and open an Excel file from Website or internal network.

    Sub OpenExcelFromWeb()
        Dim app As New Excel.Application
        Dim wb As Excel.Workbook
        app.Visible = True
        Set wb = app.Workbooks.Open("http://your excel file path")
    End Sub
    The error message seems you need to adjust Internet Security Option on the server.
    Monday, September 2, 2013 6:19 PM

All replies

  • Word can't open Excel files. In a VBA macro, you will have to create an instance of Excel and then open the file in Excel.


    Stefan Blom, Microsoft Word MVP

    Sunday, September 1, 2013 6:44 PM
  • Hi Stefan,

    Yes I know and did that but it reads a local excel file or an excel file on an internal network but not from an external website like I have explained above.

    Thanks.

    Monday, September 2, 2013 7:21 AM
  • Could you share the code here?

    I can access and open an Excel file from Website or internal network.

    Sub OpenExcelFromWeb()
        Dim app As New Excel.Application
        Dim wb As Excel.Workbook
        app.Visible = True
        Set wb = app.Workbooks.Open("http://your excel file path")
    End Sub
    The error message seems you need to adjust Internet Security Option on the server.
    Monday, September 2, 2013 6:19 PM