Early Vs Late Binding

M

M.L.Srinivas

I'm using late binding for creating word application
(sugeested by Jonathan West) and trying to insert a field
in the activedocument from VB.
I'm using the following code:

Set myfield = WordApp.ActiveDocument.Fields.Add
(Range:=WordApp.Selection.Range, _
Type:=wdFieldDocProperty, Text:="ServiceDate
\@ ""MMMM dd, yyyy""")

WordApp is my word object created thru late binding. The
above code is not working (it's working fine in case early
binding with word reference)

The error is 'Value out of range'.

Can anybody suggest..how to use selection in case of late
binding and what's wrong in the above case.

Thanks,
M.L.Srinivas
 
H

Helmut Weber

Hi,
it is the value of the constant "wdFieldDocProperty".
You may use 85 (integer) instead.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, W98
 
M

M.L.Srinivas

Mr. Weber thanks for your time and answer....My prob is
solved..thanks once again.

Merry Christmas and Happy New Year

M.L.Srinivas
 

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