Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Publisher 2003 Object Model Questions

Status
Not open for further replies.

JimKyle

Programmer
Jul 22, 2006
6
0
0
US
I make extensive use of macros in Word, to enforce my Style Book rules for a 40-page quarterly magazine that I handle for a nonprofit of which I'm a director, and would like to do the same in Publisher 2002 which is what I provide to our print shop.

However documentation for the VBA and the Publisher object model seems to be lacking and totally absent in many areas. For example, I'm trying to create a Publisher macro to automatically generate a Table of Contents for the issue, by cycling through the shapes on each page in turn and if a TextFrame contains a paragraph with style "Title" (which I've defined and use in each headline), writing the text of that paragraph, followed by a vbTab and the page number to a text file which I can then import to Word for cleanup and finally bring back into the .pub file in its own Text Box on Page 2.

One of the first problems I've found is that some headlines contain an "eyebrow" line (with style "Subtitle") before the "Title" line, and my loop failed to identify those until I added an additional test for the second paragraph in the TextRange. Since not all headlines have more than one paragraph in the TextRange, I then got runtime errors when trying to access the nonexistent second paragraph.

The main problem seems to be that there's no "Paragraphs" collection from which I could get the count.

An even more mysterious problem is that the headline on one page of my test file doesn't see the test at all, and gets skipped -- but I've not been able to find out why this happens!

Here's my main question: is there any place that provides more detail than does the help file's inadequate description and examples, or a book I could purchase that would provide the needed detail? What I really need at this point is a library of code snippets, similar to the examples in the help file but going into much greater detail...

The one post here giving a macro for saving all pages as pictures is a good example of what I'm looking for, and it told me much that I had not found elsewhere. Now I need more like that!
 
Oops! That post I found about a macro to automatically save pages was on another site altogether! I've not found anything comparable here but haven't checked every post in this forum yet...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top