Hi,
I try to automate WordXP from AccessXP (german version).
Most works fine, but when try to assign a style to a paragraph I get the
error 5946:
'NameLocal' is not a reference property. (in german: 'NameProperty' ist
keine Referenzeigenschaft.)
The source code in Access VBA is as following:
Dim objDoc As Word.Document, objWord As Word.Application, objRange As
Word.Range
Dim oParagr As Word.Paragraph, oStyle As Word.Style
...
Set objDoc = objWord.Documents.Add(Template:=gsGetTemplate, Visible:=True)
...
Set oParagr = objRange.Paragraphs.Add
oParagr.Range.Select
Set oStyle = objDoc.Styles("Standard")
Set oParagr.Range.Style = oStyle <---- here the error occurs
Please help me.
Thanks in advance
Tom Winter - 16 Feb 2005 14:36 GMT
Do not use SET when setting the style, even though you're using a style
object. I believe this:
oRange.Style = oStyle
actually works out to be:
oRange.Style.NameLocal = oStyle.NameLocal
since NameLocal is the default property of the Style object

Signature
Tom Winter
tom@nospam.amosfivesix.com
> Hi,
> I try to automate WordXP from AccessXP (german version).
[quoted text clipped - 17 lines]
> Please help me.
> Thanks in advance