Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Error 5946 in automating word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MaGi - 16 Feb 2005 11:43 GMT
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

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.