Open Word Doc from asp

Discussion in 'ASP General' started by Anne Richmond, May 12, 2004.

  1. I got the following code from a website somewhere. When I try to run it I
    get the error - Activex component can't create object "Word.Application".

    It is running on localhost and test2.doc does exist.

    What have I missed?

    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE=VBScript>
    Dim objWord
    Sub Btn1_onclick()
    call OpenDoc("Test2.doc")
    End Sub
    Sub OpenDoc(strLocation)
    Set objWord = CreateObject("Word.Application")
    objWord.Visible = true
    objWord.Documents.Open strLocation
    End Sub
    </SCRIPT>
    <TITLE>Launch Word</Title>
    </HEAD>
    <BODY>
    <INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Word Doc">
    </BODY>
    </HTML>
     
    Anne Richmond, May 12, 2004
    #1
    1. Advertising

  2. Anne Richmond

    Jeff Cochran Guest

    On Wed, 12 May 2004 15:10:24 +0100, "Anne Richmond"
    <> wrote:

    >I got the following code from a website somewhere. When I try to run it I
    >get the error - Activex component can't create object "Word.Application".
    >
    >It is running on localhost and test2.doc does exist.
    >
    >What have I missed?


    Is Word installed...? :)

    The Office web components should also be installed for this method I
    believe.

    Jeff

    ><HTML>
    ><HEAD>
    ><SCRIPT LANGUAGE=VBScript>
    >Dim objWord
    >Sub Btn1_onclick()
    >call OpenDoc("Test2.doc")
    >End Sub
    >Sub OpenDoc(strLocation)
    >Set objWord = CreateObject("Word.Application")
    >objWord.Visible = true
    >objWord.Documents.Open strLocation
    >End Sub
    ></SCRIPT>
    ><TITLE>Launch Word</Title>
    ></HEAD>
    ><BODY>
    ><INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Word Doc">
    ></BODY>
    ></HTML>
    >
     
    Jeff Cochran, May 12, 2004
    #2
    1. Advertising

  3. Anne Richmond

    TomB Guest

    Where is Test2.doc? You don't have a path at all, and I bet it's not in the
    users Temporary Internet Files.
    have you lowered your security settings to allow this?


    "Anne Richmond" <> wrote in message
    news:...
    > I got the following code from a website somewhere. When I try to run it I
    > get the error - Activex component can't create object "Word.Application".
    >
    > It is running on localhost and test2.doc does exist.
    >
    > What have I missed?
    >
    > <HTML>
    > <HEAD>
    > <SCRIPT LANGUAGE=VBScript>
    > Dim objWord
    > Sub Btn1_onclick()
    > call OpenDoc("Test2.doc")
    > End Sub
    > Sub OpenDoc(strLocation)
    > Set objWord = CreateObject("Word.Application")
    > objWord.Visible = true
    > objWord.Documents.Open strLocation
    > End Sub
    > </SCRIPT>
    > <TITLE>Launch Word</Title>
    > </HEAD>
    > <BODY>
    > <INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Word Doc">
    > </BODY>
    > </HTML>
    >
    >
     
    TomB, May 12, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Wallace
    Replies:
    0
    Views:
    478
    John Wallace
    Jul 22, 2003
  2. Stephen Witter

    opening a word doc in word not browser

    Stephen Witter, May 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    502
    Stephen Witter
    May 18, 2004
  3. Sharon
    Replies:
    0
    Views:
    614
    Sharon
    Jul 27, 2005
  4. Franck
    Replies:
    1
    Views:
    4,888
  5. Matt
    Replies:
    3
    Views:
    521
    Tor Iver Wilhelmsen
    Sep 17, 2004
Loading...

Share This Page