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)
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.
|
|
|
|
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)
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>
|
|
|
|
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)
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
|
|
|
|
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)
Hi, that still doesn't work. It starts Excel but does not open the document. Cheers Daniel.
|
|
|
|
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)
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.
|
|
|
|
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)
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.
|
|
|
|
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)
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.
|
|
|
|
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)
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.
|
|
|
|
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)
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.
|
|
|
|
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)
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.
|
|
|
|