Word: Documents.Add and Arrays
Florian Schmitt <[email protected]> Tue, 25 Jul 2006 10:15:37 -0400
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
Hi, sorry if this question is a faq, but i'm in trouble with invoking the Function Word.Documents.Add. That function takes four arguments, all of them optional and all of them of Type Variant[]. How do i set these arguments (important for me is only the first one, taking the document template)? _Document oDocument; Documents docs = app.getDocuments(); Variant[] varVorlage = new Variant[1]; varVorlage[1] = new Variant(); varVorlage[1].vt = VarTypes.VT_BSTR; varVorlage[1].bstrVal = VORBLVORL; Variant[] varTempl = new Variant[1]; varTempl[0] = new Variant(); varTempl[0].vt = VarTypes.VT_BOOL; varTempl[0].boolVal = false; Variant[] varTyp = new Variant[1]; varTyp[0] = new Variant(); varTyp[0].vt = VarTypes.VT_INT; varTyp[0].intVal = WdNewDocumentType.wdNewBlankDocument; Variant[] varTempl2 = new Variant[1]; varTempl2[0] = new Variant(); varTempl2[0].vt = VarTypes.VT_BOOL; varTempl2[0].boolVal = true; oDocument = docs.Add(varVorlage, varTempl, varTyp , varTempl2); leads to a COMException:Unable to serialize variant. Any hints or any working example? Thank you Florian