Results 1 to 8 of 8
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to run Excel macro... (2000 sr 1)

    ... hi all,
    Is possible to run or exacute an Excel mcro from an ASP page?
    Example:
    c:mywbook.xls>module1>mymacro()

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: How to run Excel macro... (2000 sr 1)

    Does this line work:

    Application.Run "'C:Myworkbook.xls'!mymacro"

    (though I do not see where the "ASP" page comes in.
    Steve

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to run Excel macro... (2000 sr 1)

    ... hummmm.
    But is possible with a simple HTML page or Javascript or Java, naturally to use only in the web page.

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to run Excel macro... (2000 sr 1)

    The only way I can imagine to do this is using a Server Side Include #exec tag to launch Excel along with a startup parameter to open a specific workboook and launch a specific macro. Remember, Excel is not designed to be interactive with web applications.

    You can learn about the #exec tag from here: http://ironbark.bendigo.latrobe.edu.au/sub...5.d/Lect09.html

    You can learn about launching Excel to run a macro from here: http://office.microsoft.com/en-us/assistan...0346281033.aspx

    Hope this helps!

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to run Excel macro... (2000 sr 1)

    Ok, tks Mark
    a little example with the tipical tag for this directive: #exec

  6. #6
    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: How to run Excel macro... (2000 sr 1)

    If you want a workbook to load into the user's copy of Excel and have a macro run, we have had a couple of posts related to that. See:

    <post#=137929>post 137929</post#> - Re: Using Excel Macros under IE4 (IE4, Excel 2000)
    <post#=130411>post 130411</post#> - Re: Generate a new doc from a dot on the web (Word 97/SR2)

    I believe those were in the intranet context, rather than the web context... Hope this helps.

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to run Excel macro... (2000 sr 1)

    Hi tks for suggestion...
    Refred ost 137929 i have run from IE this but the page not open the wbook...

    <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("c:mywbook.xls")
    STYLE="font-weight: bold;cursor: hand;">click here</SPAN>.</p>
    </body></html>

  8. #8
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to run Excel macro... (2000 sr 1)

    oh, oh, solved
    i setting correctly the Activex and page call Excel wbook, all ok!

Posting Permissions

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