Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word.Application in ASP

Status
Not open for further replies.

dbrb2

Instructor
Jul 19, 2004
121
GB
Hi -

I have written an ASP page to open a CV stored on the server, extract the text to a string, then format that string to enable a summary of the word document to be displayed as HTML. It runs fine when I host it on my local computer. However, when I run it on the server, it fails to run. It seems particularly upset about the line:

Set oWordApp = CreateObject("Word.Application")

Although the debugging is a bit vague. Does anyone know what the problem is/might be, and if there is a way around it? I tried fiddling around with the FileSystemObject methods, but haven't got very far. It seemed to be extracting garbage from the file ...


Thanks,

Ben


The listing is:


<HTML>
<HEAD>
<TITLE>Extraction Test</TITLE>
</HEAD>
<BODY>

<%
Dim oWordApp
Dim oDoc
Dim strWord
Dim Pos1
Dim Pos2
Dim text_array
Dim counter
Dim DocPath
counter=0

DocPath= "blah blah blah"

Set oWordApp = CreateObject("Word.Application")
Set oDoc = oWordApp.Documents.Open(DocPath)

strword = oDoc.range.Text

pos1 = InStr(strword, "KEY QUALIFICATIONS")
pos2 = InStr(strword, "CAREER SUMMARY")

text_array = Split( Mid(strword, pos1, pos2) , Chr(13))

While counter < Ubound(text_array)

If text_array(counter) = "KEY QUALIFICATIONS" THEN

%>
<b>KEY QUALIFICATIONS</b></p>
<%

Elseif text_array(counter) = "PROFESSIONAL AFFILIATIONS and EDUCATION" THEN

%>
</br><b>PROFESSIONAL AFFILIATIONS and EDUCATION</b></p>
<%

Else
Response.write text_array(counter)

%>
</br>
<%

End If

counter = counter +1


WEnd

oDoc.Close True
oWordApp.Quit
Set oWordApp = Nothing
Set oDoc = Nothing
Set strWord = Nothing
Set text_array = Nothing
%>



</BODY>
</HTML>
 
Possibly not....

I thought this might be the problem, but don't have direct access to the server, so can't find out for a bit. I know the server runs some office programs, but will need to check!

I've been fiddling with FileSystemObject in case I can't get word on the server, but keep getting garbage. Oh well ...


Ben
 
Hmmm....

There seem to be all kinds of problems running word on the server, from the legal to the stability end of things. There surely must be a way of doing this though ...


Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top