Custom Document Properties

C

Cory

OK, this is bugging the hell out of me...
Office XP, Publisher 2002
The VBA reference on msdn says that the DocumentProperties collection (and
thus the DocumentProperty opbject) requires a valid document object. That
makes sense right? This is supposedly part of the "Microsoft Office Object
Model" which would lead one to believe that since Publisher is a part of the
Microsoft Office package, it would inherit the whole object model.

Not the case it seems. Using the ThisDocument object to return the document
under which the code is executing, there is no DocumentProperty object. It
appears in the Object model reference under Office, but damned if I can't
find it to use it in my code. In Word ThisDocument.DocumentProperty is
valid. Not in Publisher.

Not to mention the fact that even examples that are not totally vague about
usage of the documentproperties object/collection, do not give useful code
examples (one of which purports to work in Publisher).

The hey Scriptin' Guy
(http://www.microsoft.com/technet/scriptcenter/resources/qanda/jun06/hey0614.mspx)
article that deals with this mentions Publisher, and says : "Yes, it is a
very simple little script. We start out by creating an instance of the
Excel.Application object. And you’re right: because we’re using Excel we’ve
pretty much limited ourselves to retrieving information about Excel
spreadsheets. What if we wanted to retrieve information about Word documents?
In that case, we’d need to use the Word.Application object. OK, then how
about PowerPoint presentations? That’s easy: we’d need to use the
PowerPoint.Application object. Microsoft Publisher? That’s right:
Publisher.Application."

Well who cares about creating a new instance of the application or opening
another file from the file you want to examine? Grrr! <Shakes fist at
Microsoft> Is it just me or is VBA for Publisher added to the program as an
afterthought. There are so many inconsistencies between publisher and the
REST of Office.

Any help would be greatly appreciated,
Cory
 
E

Ed Bennett

Cory said:
OK, this is bugging the hell out of me...
Office XP, Publisher 2002

Is it just me or is VBA for Publisher added to the program as an
afterthought. There are so many inconsistencies between publisher and the
REST of Office.

Publisher 2002 VBA was a pig-dog. Don't get me wrong, it was better than
what came before it, but it's quite hard to do worse than nothing. I
avoid it if I possibly can.

The quote you reference seems to be referring to scripting Publisher
externally using WSH, rather than working in VBA within the application,
so you have to create a Publisher.Application object before doing
anything. However, it doesn't look like TSG checked the object model
before putting pen to paper there!
 

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