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!

STILL having trouble with CFSCRIPT and SaveAs in Word

Status
Not open for further replies.

kathryn

Programmer
Apr 13, 2000
776
0
0
US
I am going nuts trying to get a very simple (??!!) CFSCRIPT to work. I would appreciate any ideas. I have gotten very detailed in what I have done to pinpoint the problem.

The following code works fine:

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

/* save as HTML */
objDoc.SaveAs("e:\inetpub\****END CODE SNIPPET*****

The file is saved with the new name. Therefore, I know that the SaveAs command will work.

The following code also works:


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

/*set a variable be used in the SaveAs command*/
saveName="e:\inetpub\
/* save as HTML */
objDoc.SaveAs(saveName);
****END CODE SNIPPET*****

Again, the file is saved with the new name. So I know that I can use a variable in the SaveAs command, without ## around it.

This code fails:

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

/*set a variable be used in the SaveAs command*/
saveName="e:\inetpub\ WriteOutput("SaveName: #savename#");

/* save as HTML */
objDoc.SaveAs(saveName,10);
WriteOutput("Document Saved");
****END CODE SNIPPET****

The first WriteOutput works and outputs the correct name, but the second never runs, so I know that the error is occurring on the SaveAs line. I have tried using both single and double quotes around the 10. I have also tried setting a variable equal to 10 and using the variable. I tried using wdFormatHTML, but that generates "Error resolving parameter WDFORMATHTML".

I have confirmed, using VBA code and cycling through the FileConverters collection, that the HTML Converter on the server is SaveFormat=10.

The error is:

Error on Invoke for:

COM error 0x80020005. Type mismatch.

Does anyone have a fix/workaround/beer(it is New Years Eve, after all!)???

Thanks.
Kathryn
 
Try using the Val() function around the number:

<CFSCRIPT>
[COLOR=666666]/* save as HTML */[/color]
objDoc.SaveAs(saveName,Val(10));
</CFSCRIPT> - tleish
 
You are a LIFESAVER!!!!

I have spent three days pulling my hair out on this one. Thank you so much. If I hadn't already named him, I would almost name my first born son after you! (Your name doesn't happen to be John, by any chance?)

Have a happy New Year and thanks again. Kathryn


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top