Wrox Home  
 
Search P2P Archive for  go

More Wrox Resources

  Return to Index  

asp_web_howto thread: What is wrong with this code


Message #1 by psinghp@e... on Thu, 24 Jan 2002 10:26:06 +0400
Hi EveryOne,



I have this code in ASP, which is supposed to open a word document and save it

as html document. I am trying to use this to convert word document to html in

batch mode.



At times the code opens the word document and converts it to html. All this is

done without word or html documents being visible. At other times it just sits

there and nothing happens. The IE seems to stay put.



Here is the code in question. Any suggestion of help is appreciated.



<%

 Const wdFormatHTML = 8



 Dim objWord



 Set objWord = CreateObject("Word.Application")

 objWord.Documents.Open "c:\temp\r.doc"

 objWord.ActiveDocument.SaveAs "c:\temp\R.html", wdFormatHTML



objWord.ActiveDocument.Close

objWord.Quit '<============== Important!!!

Set objWord = Nothing



 %>







Message #2 by "Chadwick DeVoss" <chad@d...> on Mon, 28 Jan 2002 16:15:47
maybe try the GetObject method



Set objWord = GetObject("c:\temp\r.doc", "Word.Application")







> Hi EveryOne,

> 

> I have this code in ASP, which is supposed to open a word document and 

save it

> as html document. I am trying to use this to convert word document to 

html in

> batch mode.

> 

> At times the code opens the word document and converts it to html. All 

this is

> done without word or html documents being visible. At other times it 

just sits

> there and nothing happens. The IE seems to stay put.

> 

> Here is the code in question. Any suggestion of help is appreciated.

> 

> <%

>  Const wdFormatHTML = 8

> 

>  Dim objWord

> 

>  Set objWord = CreateObject("Word.Application")

>  objWord.Documents.Open "c:\temp\r.doc"

>  objWord.ActiveDocument.SaveAs "c:\temp\R.html", wdFormatHTML

> 

> objWord.ActiveDocument.Close

> objWord.Quit '<============== Important!!!

> Set objWord = Nothing

> 

>  %>

> 

> 

> 


  Return to Index