Start application, Word, Excel...Possible?

Author Message
DanielHowden

  • Total Posts : 7
  • Scores: 0
  • Reward points : 0
  • Joined: 11/17/2011
  • Status: offline
Start application, Word, Excel...Possible? Sunday, November 20, 2011 9:26 PM (permalink)
0
Is it possible to start an Office application like Word or Excel from HTML? What I really want to do is open a spreadsheet for editing so I need it to be in Excel rather than being in the web browser but I can't find a way to do it. Everytime I call the spreadsheet it opens up in the browser as a copy rather than the file itself.

Cheers Daniel.
 
#1
    DanielHowden

    • Total Posts : 7
    • Scores: 0
    • Reward points : 0
    • Joined: 11/17/2011
    • Status: offline
    Re:Start application, Word, Excel...Possible? Sunday, November 20, 2011 9:28 PM (permalink)
    0
    Ive made a little progress, this will open Excel but not with the spreadsheet I am asking it for. Both the web page and .xls are in the same folder.

    Cheers Daniel.
     <HTML> <HEAD> <SCRIPT LANGUAGE=VBScript> Dim objExcel Sub Btn1_onclick() call OpenDoc("Book1.xls") End Sub
     Sub OpenDoc(strLocation)
     Set objExcel = CreateObject("Excel.Application") objExcel.Visible = true		objExcel.Documents.Open strLocation End Sub
     </SCRIPT> <TITLE>Launch Excel</Title> </HEAD> <BODY> <INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Excel File" ID=BUTTON1> </BODY> </HTML> 

    <message edited by DanielHowden on Sunday, November 20, 2011 9:31 PM>
     
    #2
      59cobalt

      • Total Posts : 981
      • Scores: 91
      • Reward points : 0
      • Joined: 7/17/2011
      • Status: offline
      Re:Start application, Word, Excel...Possible? Monday, November 21, 2011 7:56 AM (permalink)
      0
      You need to tell Excel where to look:
      Sub Btn1_onclick()
       baseUrl = Left(location, InStrRev(location, "/"))
       call OpenDoc(baseUrl & "Book1.xls")
      End Sub

      Plus, Excel "documents" are called "workbooks".
      objExcel.Workbooks.Open strLocation

       
      #3
        DanielHowden

        • Total Posts : 7
        • Scores: 0
        • Reward points : 0
        • Joined: 11/17/2011
        • Status: offline
        Re:Start application, Word, Excel...Possible? Tuesday, November 22, 2011 5:56 AM (permalink)
        0
        Hi, that still doesn't work.  It starts Excel but does not open the document.
         
        Cheers Daniel.
         
        #4
          59cobalt

          • Total Posts : 981
          • Scores: 91
          • Reward points : 0
          • Joined: 7/17/2011
          • Status: offline
          Re:Start application, Word, Excel...Possible? Tuesday, November 22, 2011 11:23 AM (permalink)
          0
          I checked it before posting, and it did work for me. What error do you get? Do you have "Show script errors" enabled in your browser? Also try adding a line "document.write baseUrl", so you see the actual value of the variable.
           
          #5
            DanielHowden

            • Total Posts : 7
            • Scores: 0
            • Reward points : 0
            • Joined: 11/17/2011
            • Status: offline
            Re:Start application, Word, Excel...Possible? Thursday, November 24, 2011 3:36 AM (permalink)
            0
            Mmm, this is the exact code I am using.  The .xls file if in the same directory as the .html file
             
            <HTML>
            <HEAD>
            <SCRIPT LANGUAGE=VBScript>
            Dim objExcel
             
            Sub Btn1_onclick()
            baseUrl = Left(location, InStrRev(location, "/"))
            call OpenDoc(baseUrl & "Alcoholics.xls")
            End Sub

            Sub OpenDoc(strLocation)
            msgbox(strLocation)
            Set objExcel = CreateObject("Excel.Application")
            objExcel.Visible = true objExcel.Workbooks.Open strLocation
            End Sub
            </SCRIPT>
            <TITLE>Launch Excel</Title>
            </HEAD>
            <BODY>
            <INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Excel File" ID=BUTTON1>
            </BODY>
            </HTML>
             
            Sorry not to put it in a code box but it seems to ruin the formatting when I do that.
             
            Cheers Daniel.
             
            #6
              59cobalt

              • Total Posts : 981
              • Scores: 91
              • Reward points : 0
              • Joined: 7/17/2011
              • Status: offline
              Re:Start application, Word, Excel...Possible? Thursday, November 24, 2011 8:01 AM (permalink)
              0
              DanielHowden
              Mmm, this is the exact code I am using.  The .xls file if in the same directory as the .html file
              Like I said: works for me. Perhaps an issue with your ActiveX security settings?

              objExcel.Visible = true
              objExcel.Workbooks.Open strLocation
              These two commands being on the same line in your posting is just the forum software messing things up again I suppose? Otherwise that'd be something you need to fix.
               
              #7
                DanielHowden

                • Total Posts : 7
                • Scores: 0
                • Reward points : 0
                • Joined: 11/17/2011
                • Status: offline
                Re:Start application, Word, Excel...Possible? Friday, November 25, 2011 2:00 AM (permalink)
                0
                Yes well spotted, they are on 2 lines in my web page.  Interesting what you say about activex.  When I run the page I get an alert saying that IE is prevented from running scripts or activex controls.  I have tried to suppress this message but I can't seem to do it.  Could this be the problem?
                 
                Any ideas how I can get rid of the message?
                 
                Cheers Daniel.
                 
                #8
                  DanielHowden

                  • Total Posts : 7
                  • Scores: 0
                  • Reward points : 0
                  • Joined: 11/17/2011
                  • Status: offline
                  Re:Start application, Word, Excel...Possible? Friday, November 25, 2011 2:14 AM (permalink)
                  0
                  Aaahhhh, got rid of the activex message but it still doesn't work!!  I still get the message that says the activex control might be unsafe.  I wonder if that is the problem.
                   
                  D.
                   
                  #9
                    DanielHowden

                    • Total Posts : 7
                    • Scores: 0
                    • Reward points : 0
                    • Joined: 11/17/2011
                    • Status: offline
                    Re:Start application, Word, Excel...Possible? Friday, November 25, 2011 2:32 AM (permalink)
                    0
                    OK, I worked it out...
                     
                    this doesn't work:-
                    call OpenDoc("c:\Alcoholics.xls")

                     
                    this does:-
                    call OpenDoc("c:\\Alcoholics.xls")

                     
                    Cheers for your help, Daniel.
                     
                    #10

                      Online Bookmarks Sharing: Share/Bookmark

                      Jump to:

                      Current active users

                      There are 0 members and 1 guests.

                      Icon Legend and Permission

                      • New Messages
                      • No New Messages
                      • Hot Topic w/ New Messages
                      • Hot Topic w/o New Messages
                      • Locked w/ New Messages
                      • Locked w/o New Messages
                      • Read Message
                      • Post New Thread
                      • Reply to message
                      • Post New Poll
                      • Submit Vote
                      • Post reward post
                      • Delete my own posts
                      • Delete my own threads
                      • Rate post

                      2000-2012 ASPPlayground.NET Forum Version 3.9