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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with CFSCRIPT and Word - COM error 0x80020005. Type mismatch.

Status
Not open for further replies.

kathryn

Programmer
Apr 13, 2000
776
0
0
US
Good afternoon, all,

I have been fighting with the CFSCRIPT below for hours. I have scoured the
Internet for help and haven't found a solution.

I found a CFSCRIPT to convert a Word document to HTML in cfcomet.com. The
code works fine with some modification, to a point. The problem comes when
I try to save as HTML. I have checked the server and the fileconverter for
HTML Document is saveformat 10 (why couldn't MS have made the file converter
codes standard on all machines???). I can save the file as a Word document
with another name, but I cannot use SaveAs. Here is the code:

****BEGIN CODE SNIPPET******
/* This will not open Word if running locally */
objApp.Visible = FALSE;

/* This returns the 'Documents' collection of the Word object */
objDocs = objApp.Documents;

/* Open the document to be converted */
objDocs.Open(tfpath&docFileName);

/* set a reference to the opened document*/
objDoc = objApp.ActiveDocument;

/* save as HTML */
objDoc.SaveAs(tfpath&newFileName,10);
****END CODE SNIPPET******

Through the use of the WriteOutput command, I know
that the code is failing on the SaveAs command.

The error I am getting is

Error on Invoke for:
COM error 0x80020005. Type mismatch.
The error occurred while processing an element with a general
identifier of (CFSCRIPT)

Any ideas???
Kathryn


 
Try using wdFormatHTML

=== START CODE EXAMPLE ===
<CFSCRIPT>
[COLOR=666666]// Code.....[/color]

[COLOR=666666]/* save as HTML */[/color]
objDoc.SaveAs(tfpath&newFileName,wdFormatHTML);

[COLOR=666666]// Code.....[/color]
</CFSCRIPT>
=== END CODE EXAMPLE === - tleish
 
thanks for the suggestion. I assumed that I had to use the code instead of the named constant. I will give that a try. Kathryn


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top