late binding Word enumeration like WdSaveFormat.wdFormatWebArchive

M

mancha28

Hi,

I have create Word object by late binding to open a Word document and
save it under another name. This new saved document should be saved as
mht-file. Following code I impelemented:

Parameters = new object[16];
Parameters[0] = "fileName.mht";
Parameters[1] = WdSaveFormat.wdFormatWebArchive;
Parameters[2] = false;
Parameters[3] = Missing.Value;
Parameters[4] = true;
Parameters[5] = Missing.Value;
Parameters[6] = false;
Parameters[7] = false;
Parameters[8] = false;
Parameters[9] = false;
Parameters[10] = false;
Parameters[11] = Missing.Value;
Parameters[12] = Missing.Value;
Parameters[13] = Missing.Value;
Parameters[14] = Missing.Value;
Parameters[15] = Missing.Value;
oDocCompare.GetType().InvokeMember("SaveAs", BindingFlags.InvokeMethod,
null, oDocCompare, Parameters);

At runtime there is an error by "Parameters[1] =
WdSaveFormat.wdFormatWebArchive;".
How can I implement this enumeration by late binding?

By early binding the code is followed and it works fine but I have to
implement this by late binding.

object compFile = "fileName.mht";
object fileFormat = Word.WdSaveFormat.wdFormatWebArchive;
object missing = Missing.Value;
object objTrue = true;
object objFalse = false;

compDoc.SaveAs(ref compFile, ref fileFormat, ref objFalse, ref missing,
ref objTrue, ref missing, ref objFalse, ref objFalse, ref objFalse, ref
objFalse, ref objFalse, ref missing, ref missing, ref missing, ref
missing, ref missing);
compDoc.ActiveWindow.View.Type = WdViewType.wdWebView;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top