Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Dec 2001
    Location
    Kent, UK
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using Excel Macros under IE4 (IE4, Excel 2000)

    I'm not sure which post section this should go under, but here goes...

    I have an Excel Spreadsheet that users button macros to open other worksheets, via the 'OpenWorksheet' command. It works fine in Excel. I've now created a Web Page using FrontPage 2000, that has a Hyperlink to start the Original Excel worksheet. This comes up fine, but when I hit one of the macro buttons it refuses to open the next worksheet. I get a 1004 error and a message saying that I cannot use the Open Worksheet command.
    Is there something I need to set in IE to allow this to run, or will it work under a later version of IE ?

    Your help would be much appreciated.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Using Excel Macros under IE4 (IE4, Excel 2000)

    This could be a problem displaying Excel worksheets inside in IE window. Try turning off "Browse in same window" for Excel files, forcing them to open in Excel. (This is set in Windows Explorer, Tools, Folder Options, File Types tab or Start, Settings, Control Panels, Folder Options, File Types tab.) Does this help?

  3. #3
    New Lounger
    Join Date
    Dec 2001
    Location
    Kent, UK
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using Excel Macros under IE4 (IE4, Excel 2000)

    Thanks for your reply, that certainly was the answer. My problem now is trying to force it to open in a new Excel window, when posted on my Company Intranet. There does not appear to be a parameter I can add to the 'Workbook.Open' macro command to enforce this. Is there something I can add to the HTML code on the webpage to set this folder option ?? - Your help is most appreciated.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Using Excel Macros under IE4 (IE4, Excel 2000)

    <P ID="edit" class=small>Edited by jscher2000 on 06-May-02 14:09.</P>You can launch an Office document from an intranet page, in the appropriate host application, by using the Windows Shell object and some VBScript code. Here is a sample page demonstrating the technique:
    <pre><html><head>
    <title>Test Script to Open Excel Workbook</title>

    <script language="vbscript">
    Sub ShellWbk(strFileName)
    ' If nothing happens, your security settings may be preventing access to WScript.Shell
    On Error Resume Next
    Dim oshell
    Set oshell = CreateObject("WScript.Shell")
    oshell.Run strFileName
    Set oshell = Nothing
    End Sub
    </script>
    </head>

    <body>
    <h3>This is a test.</h3>
    <! -- The comment tags are broken to allow posting in the lounge -- >
    <! -- Trying to open a URL will fail to run the code; you need to pass a UNC. -- >


    To open SampleSheet.xls,
    <SPAN onClick=ShellWbk("serversharefolderSampleSheet.xls ")
    STYLE="font-weight: bold;cursor: hand;">click here</SPAN>.</p>
    </body></html></pre>

    A few notes:
    1. <LI>This was written with VBScript for my convenience. If you have users who do not use IE, it probably could be recoded in JavaScript.
      <LI>The Shell control is considered "not safe for scripting" and therefore if security is set on High for the Intranet Zone, the above might do nothing. This is a trade-off your organization will have to evaluate.
      <LI>I did not emulate the appearance of a hyperlink in my SPAN tag, but you could.
    Hope this helps.

Posting Permissions

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