Consulting

Results 1 to 3 of 3

Thread: I don't want IE to open excep

  1. #1
    VBAX Newbie
    Joined
    Aug 2007
    Posts
    2
    Location

    Question I don't want IE to open excep

    Hi,

    I have an Excel document that runs macros and that will be hosted on a web site so that multiple users can access and run the file. In the site I have a link the users click on to open the file.

    When I click on the link, Excel is automatically open in Internet Explorer. I notice that when the file is opened in IE, I get multiple errors in the macros. I realize that the Excel plug-in for IE may not be able to run my macros and so I don't want IE to open the file.

    I did some research and I found out that I can change the configuration of my computers to prevent IE to open excel files. However, this is not a good solution because I would have to force many users to change settings in their individual computers they may not familiar with or may not have privileges to change. I then found a VBScript on-line that would prevent IE to open the Excel file but I had some problems with it:

    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE=VBScript>
    Dim objExcel

    Sub btnOpen_onclick()
    Dim path
    path = "C:\myfile.xls"
    call OpenWorkbook(path)
    End Sub

    Sub OpenWorkbook(strLocation)
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = true
    objExcel.Workbooks.Open strLocation
    objExcel.UserControl = true
    End Sub

    </SCRIPT>
    </SCRIPT>
    <TITLE>Launch Excel</Title>
    </HEAD>
    <BODY>

    When I run this script from c:\ it works perfectly. However, when I upload this html file to my website and try to open the excel file I get the following error:
    Error: ActiveX component can't create object: 'Excel.Application'

    The error happens here: Set objExcel = CreateObject("Excel.Application")

    Thanks in advance for your help

  2. #2
    Well, I'm not 100% sure of this but I don't think asp can run application on the client machine. Imagine you enter a site and boom it open 99999 and more Word Application:S. that would be a major security flaw.

    There are lot of things you can do locally but not on web script because of security.

    So I guess the solution is to let the user download the file then open it locally.

  3. #3
    VBAX Newbie
    Joined
    Aug 2007
    Posts
    2
    Location

    Thumbs up Thanks

    Thanks for your replay. It makes sense. It is just frustrading to have your users change their computers settings for something that should not be the way it is in the first place. If IE opens Excel then it should support everything Excel does!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •