OLE Word

I’m trying to compose a word document from Notes. No problem so far but the “tables.add” instruction gives me an error when trying to save the code in Lotus script. In Word the code below is no problem.

Does anyone has an explanation ?

Thanks

Set myapp= createobject(“Word.application”)

myapp.Documents.Add

StrTitel = “Title”

With myapp.Documents(1).Paragraphs(1).Range

.Text = StrTitel

.Font.Size = 18

End With

myapp.Documents(1).Paragraphs.Add

myapp.Documents(1).Paragraphs.Add

aantal = myapp.Documents(1).Paragraphs.Count

Set myrange = myapp.Documents(1).Paragraphs(aantal).Range

'This is the mentioned instruction

'myapp.Documents(1).Tables.Add Range:=myrange, NumRows:=1, NumColumns:=4

intkol = 1

For i = 1 To myapp.Documents(1).Tables(1).Columns.Count

	 Set myrange = myapp.Documents(1).Tables(1).Cell(1, intkol).Range 

'here comes some action

	 intkol = intkol + 1

Next

Subject: You can’t use named parameters (:=) in LotusScript

Try this instead:

myapp.Documents(1).Tables.Add myrange,1,4,1

or

Call myapp.Documents(1).Tables.Add(myrange,1,4,1)

When you omit :=, you must supply the arguments in the order that the method is expecting them, including optional parameters that aren’t being used (e.g. object.foo x,y,z if we were leaving out an optional third parameter)

Subject: RE: You can’t use named parameters (:=) in LotusScript

I tried this before but without the optional parameters. Now it works.

Thanks a lot, Jan