Opening Word

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rockocubs

    Opening Word

    I am working on a table of contents page in html for an intranet, i want
    to click on links to documents and have them open up in word and not word
    in the browser, is there a way to do this.

  • kaeli

    #2
    Re: Opening Word

    In article <f58738fd3de0df d477738dca4e229 d01
    @localhost.talk aboutprogrammin g.com>, rphipps@nospam. indy.rr.com enlightened
    us with...[color=blue]
    > I am working on a table of contents page in html for an intranet, i want
    > to click on links to documents and have them open up in word and not word
    > in the browser, is there a way to do this.[/color]

    MSIE only? Sure.
    (url provided works -- I tested with it; change to your URL)

    <script type="text/vbscript">
    Set obj = CreateObject("W ord.Application ")
    obj.Visible = true
    obj.Documents.O pen("http://www.cuhumane.or g/CARE/cats101.doc")
    </script>

    --
    --
    ~kaeli~
    No one is listening until you make a mistake.



    Comment

    • rockocubs

      #3
      Re: Opening Word

      I couldn't get it to work, so i guess i dont know where the VB script goes
      at in the code.

      Comment

      • kaeli

        #4
        Re: Opening Word

        In article <c135293296d173 bac55bc25cee2ba 1f7
        @localhost.talk aboutprogrammin g.com>, rphipps@nospam. indy.rr.com enlightened
        us with...[color=blue]
        > I couldn't get it to work,[/color]

        Did you get an error? If so, what?
        Do you have MSIE set to actually tell you about errors? For testing, you
        should.
        [color=blue]
        > so i guess i dont know where the VB script goes
        > at in the code.
        >
        >[/color]
        Depends on your code.

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <title> New Document </title>
        </head>

        <body>
        <script type="text/vbscript">
        Set obj = CreateObject("W ord.Application ")
        obj.Visible = true
        obj.Documents.O pen("http://www.cuhumane.or g/CARE/cats101.doc")
        </script>
        </body>
        </html>

        That works on my system.
        Does it work on yours?

        Note: you may get asked to confirm ActiveX, depending on IE settings.

        And you ARE using MSIE as your browser, right? Because only MSIE understands
        vbscript.

        IF YOU ARE TESTING LOCALLY (on your computer with file->open instead of from
        another server) UNDER WINXP SP2, THIS WILL NOT RUN BY DEFAULT.
        WinXP SP2 will not allow scripts to run locally unless you putz around with
        your security settings.
        (of course, you should have gotten the little warning at the top of the page
        telling you about it, but you may have disabled that or something)



        --
        --
        ~kaeli~
        Practice safe eating - always use condiments.



        Comment

        • rockocubs

          #5
          Re: Opening Word

          I got it to work after i move the code to my C: drive, but i get an error
          of the following if i try running from my network drive.

          Error ActiveX component can't creat object 'word.applicati on'

          Comment

          • kaeli

            #6
            Re: Opening Word

            In article <9d6622be3b06cc d66e9f4ed6c5763 2d1
            @localhost.talk aboutprogrammin g.com>, rphipps@nospam. indy.rr.com enlightened
            us with...[color=blue]
            > I got it to work after i move the code to my C: drive, but i get an error
            > of the following if i try running from my network drive.
            >
            > Error ActiveX component can't creat object 'word.applicati on'
            >[/color]

            Ah, I see.
            It's your security settings, I think.
            Making sure you're not online anywhere else, lower your IE settings to Low
            for all the zones (one at a time, then put back to where it was) to see which
            zone your PC thinks this is running from. (probably intranet zone) Each time
            you lower it for a zone, check and see if it works.

            Did it work?
            Note that your users may also have problems with this (I usually use this
            sort of thing in an HTA, which has special permissions).
            Check into signing it.

            If you have problems, your users may just need to tweak their browsers to
            open the documents independently instead of in the browsers themselves (where
            they open is a setting).

            To have an individual person tweak how their PC handles Word docs, see this
            link:


            --
            --
            ~kaeli~
            If it's tourist season, why can't we shoot them?



            Comment

            • rockocubs

              #7
              Re: Opening Word

              Secuirty in the intranet zone was the problem.
              Thanks for all of your help.

              Comment

              • rockocubs

                #8
                Re: Opening Word

                I am wondering if there is a way to pass the filename to the btn1 on-click
                sub so it can be reused.

                <HEAD>

                <script type="text/vbscript">
                Dim objWord
                Sub Btn1_onclick()
                call OpenDoc("K:\Del oitte\Team1 Status report\JavaProg rams\hi.txt")
                End Sub



                Sub OpenDoc(strLoca tion)

                Set objWord = CreateObject("W ord.Application ")
                objWord.Visible = true
                objWord.Documen ts.Open strLocation
                End Sub
                </script>

                This is in the Boddy.
                <td><INPUT TYPE=BUTTON NAME=Btn1 VALUE="Requirem ents Template"></td>

                Comment

                Working...