<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Andrew May's WebLog : Publisher</title><link>http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx</link><description>Tags: Publisher</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Publisher Object Model Overview Article Now Live on MSDN</title><link>http://blogs.msdn.com/andrew_may/archive/2005/09/01/Publisher7ThingsArticleLive.aspx</link><pubDate>Fri, 02 Sep 2005 00:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:459378</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/459378.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=459378</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=459378</wfw:comment><description>&lt;P class=Text style="MARGIN: 3pt 0in"&gt;&lt;FONT face=Verdana size=2&gt;Yesterday saw the publication of my penultimate article on Publisher 2003, &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/office/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/OfficePublisher7ThingsObjectModelPart1.asp"&gt;&lt;FONT face=Verdana size=2&gt;7 Things Developers Should Know About the Publisher 2003 Object Model, Part 1&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;. If you're an Office developer new to the Publisher object model (or new to Publisher in general), this article and its sequel aim to give you a quick overview of the unique aspects of the Publisher developer story.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in"&gt;&lt;FONT face=Verdana size=2&gt;These articles grew out of the fact that I was handing off the responsibility for Publisher developer documentation to another programmer-writer for the Office "12" release. As part of the transition, I had thought of a handful of areas where Publisher functionality or the object model was unique enough to require some explanation, even to the experienced programmer-writer taking my place. I wrote up a few of these areas on this blog (&lt;/FONT&gt;&lt;A href="https://blogs.msdn.com/andrew_may/archive/2005/04/25/CreateWebPagesWithPublisherObjectModel.aspx"&gt;&lt;FONT face=Verdana size=2&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;, &lt;/FONT&gt;&lt;A href="https://blogs.msdn.com/andrew_may/archive/2005/05/09/OfficePublisherUsingWizardsAndTemplates.aspx"&gt;&lt;FONT face=Verdana size=2&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;, and &lt;/FONT&gt;&lt;a href="http://blogs.msdn.com/andrew_may/archive/2005/05/13/OfficePublisherUsingStoryAndLinkedTextBoxes.aspx"&gt;&lt;FONT face=Verdana size=2&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;), then decided to turn the whole thing into an MSDN article. Which naturally became two.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in"&gt;&lt;FONT face=Verdana size=2&gt;Part 1 covers the following areas:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;General object model structure&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;The ThisDocument object&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;Commercial Printing Support in the object model&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;Catalog and mail merge&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in"&gt;&lt;FONT face=Verdana size=2&gt;While Part 2, most likely to be published next week, tackles these topics:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;Wizards and templates&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;Web pages&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;Stories and linked text boxes&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text style="MARGIN: 3pt 0in"&gt;&lt;FONT face=Verdana size=2&gt;I actually wrote these articles a few months back, but for various publishing reasons they're only now seeing the light of day. (My editor told me they were holding off publishing them in order to not overshadow the release of &lt;/FONT&gt;&lt;A href="http://www.amazon.com/exec/obidos/tg/detail/-/0439784549/qid=1125609782/sr=2-1/ref=pd_bbs_b_2_1/102-1967889-3328129?v=glance&amp;amp;s=books"&gt;&lt;FONT face=Verdana size=2&gt;Harry Potter VI&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;. I can see that.)&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=459378" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category></item><item><title>Publisher 2003: Creating and Managing Linked Text Boxes</title><link>http://blogs.msdn.com/andrew_may/archive/2005/05/13/OfficePublisherUsingStoryAndLinkedTextBoxes.aspx</link><pubDate>Sat, 14 May 2005 01:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:417343</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/417343.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=417343</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=417343</wfw:comment><description>&lt;P class=AlertText&gt;&lt;SPAN&gt;&lt;FONT face=Verdana&gt;(&lt;B&gt;Note:&lt;/B&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;This is the third in a series of entries that aim to introduce experienced programmers to the Publisher object model. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=AlertText&gt;&lt;SPAN&gt;&lt;FONT face=Verdana&gt;The first entry covered creating Web pages programmatically. You can read it &lt;/FONT&gt;&lt;a href="https://blogs.msdn.com:443/andrew_may/archive/2005/04/25/CreateWebPagesWithPublisherObjectModel.aspx"&gt;&lt;FONT face=Verdana&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=AlertText&gt;&lt;SPAN&gt;&lt;FONT face=Verdana&gt;The second entry covered working with wizards and templates. You can read it &lt;/FONT&gt;&lt;A href="https://blogs.msdn.com/andrew_may/archive/2005/05/09/OfficePublisherUsingWizardsAndTemplates.aspx"&gt;&lt;FONT face=Verdana&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana&gt;.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;While the way you work with text in the Publisher object model is very similar to how you work with text in other word processing applications, such as Word, in does differ in one very important aspect: because Publisher is a desktop design and publishing application, it provides you to ability to include multiple text flows in a single publication, and programmatically control how those flows are laid out and formatted.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;For example, suppose you needed to create a newsletter. You would probably want to include several different articles, each with their own distinct content and formatting. In addition, a given article might continue from one page to another; those pages might not be contiguous. The final result might look something like the three-page newsletter in Figure 1.&lt;/FONT&gt;&lt;/P&gt;&lt;IMG src="http://ajmay2.home.comcast.net/blogart/OfficePublisherObjectModel2_1.gif"&gt; 
&lt;P class=Figure&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=Label&gt;&lt;STRONG&gt;&lt;FONT face=Verdana size=2&gt;Figure 1. Lay out of a sample newsletter.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;In Publisher, each distinct flow of text is referred to as a &lt;I&gt;story&lt;/I&gt;. A given story may span one or more textboxes, on one or more pages. Those pages need not be contiguous. Consider the sample newsletter in Figure 1. The first story is contained in a single text box on the first page. The second story starts in a text box on page one, then concludes in another textbox on page three. Story three is contained in three text boxes: two on page two, and a single text box on page three.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Publisher lets you link multiple text boxes together to contain a story, and automatically manages how text flows from one text box to the next. If there isn't room to display all the story text in the first text box, the text flows into the second, and so on. If there's too much text to display in the final text box, Publisher stores the remaining text in an &lt;I&gt;overflow buffer&lt;/I&gt;. Publisher automatically adjusts the amount of text contained in each text box as you resize the textboxes, format the text, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;H6&gt;&lt;FONT face=Verdana size=2&gt;Using the Story Object to Manage Text&lt;/FONT&gt;&lt;/H6&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;When working with story text through the Publisher object model, it is important to distinguish between the story itself, and the individual text boxes that contain it. Each story in a given publication is represented by a &lt;B&gt;Story&lt;/B&gt; object contained in the &lt;B&gt;Document.Stories&lt;/B&gt; collection. Operations performed on a &lt;B&gt;Story&lt;/B&gt; object affect the entire story, regardless of the textboxes in which it is contained. For example, the following code sets the font size for a story to 12 points, for all the text boxes that contain that story.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Activedocument.Stories(2).TextRange.Font.Size=12&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The following example, on the other hand, set the font size for only the story text contained in the specific textbox:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Activedocument.Pages(1).Shapes("Story2TextBox1") _&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;.TextFrame.TextRange.Font.Size=12&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;You can not create or delete stories through the &lt;B&gt;Stories&lt;/B&gt; collection. Rather, when you add a textbox to the publication, you are also adding a new story to the publication. For example, the following code adds a textbox, and therefore a story, to the active publication, even though no text has been specified for the text box.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;ActiveDocument.Pages(1).Shapes.AddTextbox _&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Orientation:=pbTextOrientationHorizontal, _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Left:=72, Top:=72, Width:=200, Height:=200&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;If you then deleted the text box, or linked it to an existing text box, the number of stories in the publication would decrease by one. Use the &lt;B&gt;Stories.Count&lt;/B&gt; property to return the number of stories in a publication at a given time.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To delete a story, you must delete each text box that contains the story text.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Use the &lt;B&gt;TextFrame&lt;/B&gt; property to access the text frame of the first text box of a story. Use the &lt;B&gt;TextRange&lt;/B&gt; property to return the full text of the story.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;A story may also be placed within a table, in which case the story would be contained in one or more Cell objects rather than &lt;B&gt;TextFrame&lt;/B&gt; objects. In such a case, use the &lt;B&gt;Cell.TextRange&lt;/B&gt; property to access the text in a specific table cell. Use the &lt;B&gt;HasTextFrame&lt;/B&gt; property to determine if a story is contained in one or more &lt;B&gt;TextFrame&lt;/B&gt; objects.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The only objects to which you can link a text box are:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;An empty text box that is not already part of a chain of connected text boxes.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;A &lt;/FONT&gt;&lt;SPAN class=MsoCommentReference&gt;&lt;SPAN&gt;drawing shape that has a text frame. To determine if a shape has a text frame, use the &lt;B&gt;Shape.HasTextFrame&lt;/B&gt; property.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H6&gt;&lt;FONT face=Verdana size=2&gt;Using the TextFrame Object to Manage Story Content&lt;/FONT&gt;&lt;/H6&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Each text box contains a &lt;B&gt;TextFrame&lt;/B&gt; object, which contains the text in shape, as well as the properties that control the margins and orientation of the text frame. The &lt;B&gt;TextFrame&lt;/B&gt; object includes several members that enable you to determine if a text box is part of a linked story, and to set or sever the connections between text boxes.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To determine if a text box is connected to a preceding or following text box, use the &lt;B&gt;HasPreviousLink&lt;/B&gt; and &lt;B&gt;HasNextLink&lt;/B&gt; properties, respectively. To access the text frames of those connected shapes, use the &lt;B&gt;PreviousLinkedTextFrame&lt;/B&gt; and &lt;B&gt;NextLinkedTextFrame&lt;/B&gt; properties. To connect one text box to the text box you want to follow it, use the &lt;B&gt;NextLinkedTextFrame&lt;/B&gt; property as well.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To break the forward link for a specified text frame, use the &lt;B&gt;BreakForwardLink&lt;/B&gt; method. Applying this method to a shape in the middle of a chain of shapes with linked text frames will break the chain, leaving two sets of linked shapes. All of the text, however, will remain in the first series of linked shapes.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The following example illustrates the relationship between a story and the connected text boxes that contain it. The example adds three text boxes to the active publication, and adds text to the first text box. At this point, with the text boxes not connected, three stories have been added to the publication's &lt;B&gt;Stories&lt;/B&gt; collection. Next, the example links the three text boxes together by setting the &lt;B&gt;NextLinkedTextFrame&lt;/B&gt; property of the first two text boxes. By doing this, two stories have been removed from the &lt;B&gt;Stories&lt;/B&gt; collection. Note that the code calls the &lt;B&gt;ValidLinkTarget&lt;/B&gt; method to determine if each text frame is a legitimate target to which to link.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Finally, the third text box is disconnected by calling the &lt;B&gt;BreakForwardLink&lt;/B&gt; method for the second text box. The story text is now stored only in the first two text boxes, and the overflow buffer if necessary. In addition, text box three now represents a new, empty story.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Sub BreakTextLink()&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Dim tb1 As Shape&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Dim tb2 As Shape&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Dim tb3 As Shape&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Set tb1 = ActiveDocument.Pages(1).Shapes.AddTextbox _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;(Orientation:=msoTextOrientationHorizontal, _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Left:=72, Top:=36, Width:=72, Height:=36)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;tb1.TextFrame.TextRange = "This is some text. " _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;amp; "This is some more text. This is even more text. " _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;amp; "And this is some more text and even more text."&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Set tb2 = ActiveDocument.Pages(1).Shapes.AddTextbox _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;(Orientation:=msoTextOrientationHorizontal, _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Left:=72, Top:=108, Width:=72, Height:=36)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Set tb3 = ActiveDocument.Pages(1).Shapes.AddTextbox _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;(Orientation:=msoTextOrientationHorizontal, _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Left:=72, Top:=180, Width:=72, Height:=36)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;ShowStoryCount&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;If tb1.TextFrame.ValidLinkTarget(tb2) Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;tb1.TextFrame.NextLinkedTextFrame = tb2.TextFrame&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;End If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;If tb2.TextFrame.ValidLinkTarget(tb3) Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;tb2.TextFrame.NextLinkedTextFrame = tb3.TextFrame&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;End If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;ShowStoryCount&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;tb2.TextFrame.BreakForwardLink&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;ShowStoryCount&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Function ShowStoryCount()&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;MsgBox "There are currently " &amp;amp; _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ActiveDocument.Stories.Count &amp;amp; _&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;" stories in this publication.", , "Story Count"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Function&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;There is no object in the Publisher object model that represents the overflow buffer for a specific story. Each TextFrame has an &lt;B&gt;Overflowing&lt;/B&gt; property, however, that indicates whether text is overflowing from that text box into the overflow buffer. For linked text frames, only the final text frame can be overflowing.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;For a given story, the text in the overflow buffer is the difference between the &lt;B&gt;End&lt;/B&gt; property of the final linked &lt;B&gt;TextFrame&lt;/B&gt; in the story, and the &lt;B&gt;End&lt;/B&gt; property of the &lt;B&gt;Story&lt;/B&gt; object itself.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;For example, the following procedures retrieves the text in the overflow buffer. First, the code determines if the selected text box has overflow text. If it does, the procedure retrieves the text contained in the overflow buffer by using the &lt;B&gt;Characters&lt;/B&gt; method. This method returns a &lt;B&gt;TextRange&lt;/B&gt; object that contains the characters from the end of the text box &lt;B&gt;TextRange&lt;/B&gt; object to the end of the &lt;B&gt;Story&lt;/B&gt; object. The code then uses the &lt;B&gt;Text&lt;/B&gt; property of the resulting &lt;B&gt;TextRange&lt;/B&gt; object to return a string representing the overflow text, which it then displays in a message box.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Sub GetOverflowText()&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Dim ot As String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;With Selection.ShapeRange(1).TextFrame&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;If .Overflowing Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;With .TextRange&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ot = .Characters(.End, .Story.TextRange.End).Text&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;MsgBox prompt:=ot, Title:="Overflow Text"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;End With&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;End If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;End With&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Also, each TextFrame object also has an &lt;B&gt;AutoFitText&lt;/B&gt; property, which lets you set how you want Publisher to deal with overflowing text:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Allow the text to overflow&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Reduce the text size so that the it fits in the text frame&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Reduce or enlarge the text size so it fills the text frame&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The following text boxes cannot be part of a chain of connected text boxes: headers or footers, navigation bars, inline objects, personal information text boxes, text boxes already containing text, or text boxes set to automatically reduce text size.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Finally, each &lt;B&gt;TextFrame&lt;/B&gt; and &lt;B&gt;TextRange&lt;/B&gt; object has a &lt;B&gt;Story&lt;/B&gt; property, which enables you to access the Story object associated with a specific text frame or text range.&lt;/FONT&gt;&lt;/P&gt;
&lt;H6&gt;&lt;FONT face=Verdana size=2&gt;The Publisher Story Object Model&lt;/FONT&gt;&lt;/H6&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Figure 2 illustrates the structure of the Publisher object model surrounding the &lt;B&gt;Story&lt;/B&gt; object. It also includes the &lt;B&gt;TextFrame&lt;/B&gt; properties concerned with manipulating the text frames of a specific story.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Figure&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://ajmay2.home.comcast.net/blogart/OfficePublisherObjectModel2_2.gif"&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://ajmay2.home.comcast.net/blogart/OfficePublisherObjectModel2_2b.gif"&gt;&lt;/P&gt;
&lt;P class=Label&gt;&lt;STRONG&gt;&lt;FONT face=Verdana size=2&gt;Figure 2. The Story Object Model Structure&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=417343" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Working with Publisher Wizards and Templates</title><link>http://blogs.msdn.com/andrew_may/archive/2005/05/09/OfficePublisherUsingWizardsAndTemplates.aspx</link><pubDate>Mon, 09 May 2005 23:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:415807</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/415807.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=415807</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=415807</wfw:comment><description>&lt;P class=AlertText&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;B&gt;Note:&lt;/B&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;This is the second in a series of entries that aim to introduce experienced programmers to the Publisher object model. The first entry covered creating Web pages programmatically. You can read it &lt;/FONT&gt;&lt;/FONT&gt;&lt;a href="http://blogs.msdn.com/andrew_may/archive/2005/04/25/CreateWebPagesWithPublisherObjectModel.aspx"&gt;&lt;FONT face=Verdana size=2&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Publisher has a different concept of templates and wizards than other Office programs, such as Word. In Publisher, both terms refer to publication types on which you can base your publications, with important differences:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;Publication wizards are pre-defined publications that come bundled with Publisher. These publication wizards contain text boxes and other design elements that you can customize, and to which you can add your content, in the publications you create using them. Publication wizards also contain design automation options that enable you to quickly change the lay out and design of your publication.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;Templates are user-created publications that you can save to use as the basis for creating other publications. If you save the template to a specific location, Publisher then makes it available as a template on the New Publication task pane in the application interface.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Let’s examine each of these in detail.&lt;/FONT&gt;&lt;/P&gt;
&lt;H6&gt;&lt;FONT face=Verdana size=2&gt;Using Wizards in Publisher 2003&lt;/FONT&gt;&lt;/H6&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Publication wizards are one of the most powerful and versatile features in Microsoft® Office Publisher 2003. As mentioned above, wizards are pre-defined publication templates included as part of Publisher. Wizards enable you to quickly generate professional-looking publications in a wide range of formats, from invitations to flyers to catalogs to websites.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;When you create a publication using a wizard, Publisher populates the new publication with design elements based on the wizard type and design you choose. You can add your content to these elements, as well as customize the elements as you desire. You can change the appearance of the publication later by simply specifying a different design available for that wizard. The wizard then &lt;I&gt;morphs&lt;/I&gt; the publication to adhere to that design scheme.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;In Publisher, morphing refers to an object’s ability (be it a shape, page, or entire publication) to change its appearance based on the user’s choice of design. Choose a different design, and Publisher automatically updates the object according to the design chosen.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Some wizards generate multi-page publications, with different content and design options depending on the page. For example, a newsletter may include different design elements present on the front cover than on the interior pages.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Unlike templates in applications such as Word, you cannot access or alter publication wizards themselves. However, you can create a user-defined template based on a publication wizard. In such a case, you can alter the template in any way you like, such as adding VBA code to the publication, and the template retains the morphing and other functionality of the wizard on which it is based. For more information, see “Working with Templates.”&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The Publisher object model lets you extend the design flexibility in publication wizards even farther by automating the generation and customization of publications based on wizards. Any publication created based on a publication wizard template has a &lt;B&gt;Wizard&lt;/B&gt; object as the child of its &lt;B&gt;Document&lt;/B&gt; object. If you create a publication based on a multi-page wizard template, the individual pages in the publication may have wizard properties that apply to only that page. In such a case, each &lt;B&gt;Page&lt;/B&gt; object in the publication contains its own &lt;B&gt;Wizard&lt;/B&gt; object as well. For more information on programmatically working with publication wizards, see &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/office/understanding/publisher/articles/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/odc_pb_createwizardpubs.asp"&gt;&lt;FONT face=Verdana size=2&gt;Creating and Customizing Wizard Publications in Publisher 2003&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;But not only do publications and pages have wizard properties, but shapes do as well. Any shape that Publisher adds to the default appearance of a publication based on a wizard design has properties that uniquely identify it. Publisher uses these properties to keep track of shapes that ‘belong’ to the wizard design, as opposed to any custom shapes the user might add to the publication later. For more information, see &lt;/FONT&gt;&lt;a href="http://blogs.msdn.com/andrew_may/archive/2004/02/10/70900.aspx"&gt;&lt;FONT face=Verdana size=2&gt;Identifying wizard shapes in a publication&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=AlertText&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;B&gt;Note&lt;/B&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Publisher also includes &lt;I&gt;group wizard shapes&lt;/I&gt;, which are related to, but independent from, the publication and page-level wizards. Group wizard shapes are pre-defined group shapes, such as calendars, coupons or Web navigation bars, that contain design automation options. Unlike wizard publications, you can add group wizard shapes to any publication, whether or not it’s based on a publication wizard. Also, You set the design of each group wizard shape individually. For more information, see &lt;/FONT&gt;&lt;/FONT&gt;&lt;a href="http://blogs.msdn.com/andrew_may/archive/2004/02/16/74404.aspx"&gt;&lt;FONT face=Verdana size=2&gt;Working with group wizard shapes&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;H6&gt;&lt;FONT face=Verdana size=2&gt;Creating and Using Templates in Publisher 2003&lt;/FONT&gt;&lt;/H6&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;You can also create templates in Publisher. Templates are especially useful if you create certain publications, such as newsletters, flyers, or postcards, over and over again. Templates enable you to design master publications that reflect your company’s brand and identity; you can then use that template to create new publications, adding only the information that is unique to each publication.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Publisher templates are simply publications saved to a specific user directory. Each time you launch a new instance of Publisher, the application makes the publications in that directory available as template on the New Publication task pane. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;SPAN&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;To create a template, save your publication to the following user directory:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;I&gt;Drive&lt;/I&gt;:\Documents and Settings\&lt;I&gt;userName&lt;/I&gt;\Application Data\Microsoft\Templates&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Where &lt;I&gt;Drive&lt;/I&gt; represents the computer drive letter, and &lt;I&gt;userName&lt;/I&gt; represents the name of the user to whom you want to make this publication available as a template. If you want to make the template available to multiple users on the same computer, you must save the template to the above location in each user’s directory.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;Publisher displays available templates under &lt;B&gt;Templates &lt;/B&gt;in the &lt;B&gt;New Publications &lt;/B&gt;task pane. Because Publisher loads the available templates on launch, you need to open a new instance of Publisher to for the new template to be available. Even then, the new template is not displayed &lt;SPAN&gt;in any instances of Publisher launched before the template was saved.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;SPAN&gt;&lt;FONT face=Verdana size=2&gt;If you do not have any templates saved, the &lt;B&gt;Templates&lt;/B&gt; folder does not appear on the &lt;B&gt;New Publication&lt;/B&gt; task pane.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To save a publication as a template programmatically, use the &lt;B&gt;Document.SaveAs&lt;/B&gt; method, specifying the file location above in the &lt;B&gt;&lt;I&gt;Filename&lt;/I&gt;&lt;/B&gt; parameter. This is directly equivalent to selecting &lt;B&gt;Save as type: Publisher Template &lt;/B&gt;in the &lt;B&gt;Save As&lt;/B&gt; dialog box.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The following function saves the specified document as a template:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;Function SaveAsTemplate(pub As Document, fileName As String)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;With pub&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;.SaveAs fileName:= _&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"&lt;I&gt;C&lt;/I&gt;:\Documents and Settings\&lt;I&gt;user&lt;/I&gt;\Application Data\Microsoft\Templates\" _&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;amp; fileName, _&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Format:=pbFilePublication, _&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;AddToRecentFiles:=False&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;End With&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;End Function&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;You can specify custom categories to group your templates. The custom categories are listed under &lt;B&gt;Templates &lt;/B&gt;in the &lt;B&gt;New Publications &lt;/B&gt;task pane. To do this, specify a category for the publication before you save it as a template. From the &lt;B&gt;File&lt;/B&gt; menu, select &lt;B&gt;Properties&lt;/B&gt;. On the &lt;B&gt;Summary&lt;/B&gt; tab, enter a value for &lt;B&gt;Category&lt;/B&gt;. If you do not specify a category for your template, Publisher displays it in a category named &lt;B&gt;My Templates&lt;/B&gt; by default.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=AlertText&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;B&gt;Note&lt;/B&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;There is no way to programmatically set a publication's properties, such as Category, using the Publisher object model.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Any Visual Basic for Applications (VBA) code contained in the template gets copied into any publications you later create based on the template.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;If you create a template based on a publication wizard, any publications you create based on the template retain the design automation functionality of the wizard.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Publications based on a template retain no link to that template. Any changes you later make in the template are not propagated to any publications previously created from that template.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Programmatically, work with templates as you would with any other Publisher files. There are no object model objects or properties specific to templates. For example, you cannot create a publication based on a template using the &lt;B&gt;NewDocument&lt;/B&gt; method. In such a case, use the &lt;B&gt;Document.Open&lt;/B&gt; method to open the template file directly, and then use the &lt;B&gt;Document.SaveAs&lt;/B&gt; method to create a new publication based on the template.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H6&gt;&lt;FONT face=Verdana size=2&gt;Making Macros Available in Publisher Templates&lt;/FONT&gt;&lt;/H6&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;As mentioned above, you cannot edit any of the publication wizards included in Publisher. You can, however, create a template based on a publication wizard. This template could include any code you wanted to make available for publications based on that publication wizard.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;However, because users employ a number of publication wizards to create a wide range of publication types, in many cases it’s not practical to make your macro code available through creating templates. If you had particular macro functionality you wanted to make available for all publication types, you would have to create a separate template with that code for each publication wizard. In such cases, it’s best to just create an add-in for Publisher and deploy your code that way.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=415807" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Publisher 2003: Using the NewDocument and DocumentOpen Events</title><link>http://blogs.msdn.com/andrew_may/archive/2005/05/04/PublisherUsingNewDocumentOpenDocumentEvents.aspx</link><pubDate>Thu, 05 May 2005 03:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:414775</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/414775.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=414775</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=414775</wfw:comment><description>&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;I got an email the other day from a user who asked if the &lt;B&gt;NewDocument&lt;/B&gt; event in Publisher actually worked. It does, but it is a little more complicated than you'd think. Read on.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To enable event handling within a typical application, you create a new class module, and declare an &lt;B&gt;Application&lt;/B&gt; object with events:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;Public WithEvents App As Publisher.Application&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Then, write your event handlers:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;Private Sub App_NewDocument(ByVal Doc As Document)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;MsgBox "You've created a new publication", , "New Pub Created"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Finally, initialize the your object with the &lt;B&gt;Application&lt;/B&gt; object:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;Dim pub As New Class1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;Sub Register_Event_Handler()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Set pub.App = Publisher.Application&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Which is exactly what the user was doing. But whenever he created a new document, either through the user interface or programmatically, his &lt;B&gt;NewDocument&lt;/B&gt; event handler was never invoked. The &lt;B&gt;NewDocument&lt;/B&gt; event didn't seem to be firing.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Actually, it was; he just hadn't hooked up his event handler to the right &lt;B&gt;Publisher.Application&lt;/B&gt; object.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Publisher is a single document interface (SDI) application; each document you have open resides in a separate instance of Publisher. Which means if you have an instance of Publisher that already contains an open document, and you open another document, you're actually launching another instance of Publisher first. That second instance of Publisher then opens the document, even though it looks like you're launching the document directly from the first instance.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;That's why his &lt;B&gt;NewDocument&lt;/B&gt; event handler never fired. His code was watching the first instance of Publisher; but with a document already open in the first instance, any commands to create a new document actually launched another instance of Publisher, which is where the &lt;B&gt;NewDocument&lt;/B&gt; event was raised.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The same is true of the &lt;B&gt;DocumentOpen&lt;/B&gt; event; if the instance of Publisher already contains an open document, then an additional instance launches, and the &lt;B&gt;DocumentOpen&lt;/B&gt; event is raised in that second instance.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The only time either event would occur in an existing instance of Publisher is if Publisher was open, but didn't have a document open. Which means you can't write VBA code in a document to have it watch it's own application instance for those events. By simple fact that the document containing the VBA code was open, additional instances of Publisher would be launched for any open or new document commands.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;You can, of course, use the &lt;B&gt;DocumentOpen&lt;/B&gt; and &lt;B&gt;NewDocument&lt;/B&gt; events from:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;Another instance of Publisher&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;A Publisher add-in&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=BulletedList1&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;·&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Verdana size=2&gt;Another application&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;So let's create an example for the first bullet point, another instance of Publisher. The example below creates a new instance of Publisher, and initializes code to respond to events raised within that instance.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;First, create a new class module, and declare an &lt;B&gt;Application&lt;/B&gt; object with events, as you would normally:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Public WithEvents App As Publisher.Application&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Then, write handler procedures for all the application events to which you want to respond: &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Private Sub App_DocumentBeforeClose(ByVal Doc As Document, Cancel As Boolean)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;MsgBox "You are about to close: " &amp;amp; Doc.Name&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Private Sub App_DocumentOpen(ByVal Doc As Document)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;MsgBox "You have opened: " &amp;amp; Doc.Name, , "Document Open"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Private Sub App_NewDocument(ByVal Doc As Document)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;MsgBox "You've created a new publication", , "New Pub Created"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;o:p&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Private Sub App_WindowPageChange(ByVal Vw As View)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;MsgBox "Hey", , "Window Page Change Event"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;However, in the procedure that initializes your application object, set your variable to the application instance launched when Publisher opens a new document, not the application instance that contains the document with the VBA project.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;For example, the following code creates a new document, and initializes the &lt;B&gt;pub.App&lt;/B&gt; variable with the resulting new instance of Publisher. The event handlers now fire when events are raised in that application instance. Calling the NewDocument method, as the next line of code does, actually results in two events: the DocumentBeforeClose event for the new document open in the previous line, and then the NewDocument event for the new document that replaces it. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Dim pub As New Class1&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Sub InitializeNewPubInstance()&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Set pub.App = NewDocument.Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;pub.App.NewDocument&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;You could also create a new instance of Publisher using the &lt;B&gt;New&lt;/B&gt; VB keyword. However, instances of Publisher launched this way are not visible by default; this enables you to launch Publisher and automate it without displaying it to the user. So you have to explicitly specify the application be visible, like so:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Sub NewDocTest()&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Set pub.App = New Publisher.Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;pub.App.ActiveWindow.Visible = True&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;pub.App.NewDocument&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Now you event handler can respond to events the user raises in that Publisher instance, including &lt;B&gt;DocumentOpen&lt;/B&gt; and &lt;B&gt;NewDocument&lt;/B&gt; events. The event handlers I wrote simply pop up message boxes, but you get the idea. Just remember, those message boxes will appear in the Publisher instance &lt;I&gt;running the code&lt;/I&gt;, not the Publisher instance actually raising the events.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;One last piece of house-keeping. We want to release the &lt;B&gt;pub.App&lt;/B&gt; variable if and when the user closes that instance of Publisher. So let's create a procedure that does that, and place it in the &lt;B&gt;ThisDocument&lt;/B&gt; project:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Public Sub FreeApp()&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Set pub.App = Nothing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;And then call that procedure from the &lt;B&gt;Quit&lt;/B&gt; event handler: &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;Private Sub App_Quit()&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;ThisDocument.FreeApp&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;FONT face="Courier New" size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;On a related note, did you know it's impossible to programmatically arrive at a Publisher instance that doesn't have a document open? The &lt;B&gt;New&lt;/B&gt; keyword launches a new instance of Publisher, with a new blank publication open. The &lt;B&gt;Document.Close&lt;/B&gt; method closes the current publication, but then opens a new blank publication in it's place. There is no way to launch Publisher without also opening a publication. Likewise, there is no way to programmatically close the current publication without either also closing Publisher, or getting a new publication in its place. To get an instance of Publisher without an open publication, you have to go through the user interface.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=414775" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Creating Web Pages with the Publisher Object Model</title><link>http://blogs.msdn.com/andrew_may/archive/2005/04/25/CreateWebPagesWithPublisherObjectModel.aspx</link><pubDate>Mon, 25 Apr 2005 22:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:411835</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/411835.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=411835</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=411835</wfw:comment><description>&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;You know, sometimes it's the obvious things you miss. I was meeting a few days ago with the programmer-writer who is taking over writing Publisher developer help for the next release. I was giving him a guided tour of the Publisher object model, and I thought "you know, this should really be written down somewhere."&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Oops.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;I had written an &lt;/FONT&gt;&lt;A href="http://search.microsoft.com/search/results.aspx?qu=publisher+programming+made+easy&amp;amp;View=msdn&amp;amp;st=b&amp;amp;c=0&amp;amp;s=1&amp;amp;swc=0"&gt;&lt;FONT face=Verdana size=2&gt;entire series&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; for beginning developers on how to get started with the Publisher object model. But somehow I had never gotten around to writing an article that contained the things an experienced programmer would want to know if they were coming to the Publisher object model—and perhaps Publisher as a whole—for the first time.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;So I've decided to see if I can't write a series of entries here that address the issues an experienced programmer would encounter as they ramp up on the Publisher object model. With any luck, I'll be able to roll them into an actual article somewhere down the road.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Here's the first of those topics. It's a snappy little number I like to call:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;B&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;Creating Web Pages with the Publisher Object Model&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;You can create web pages with Publisher 2003. In Publisher 2003, there are two types of publications: print publications, and web publications. A web publication represents a group of web pages. Each publication page corresponds to a single web page. You create and design the pages within Publisher as you would a print publication. When you have finished designing your web publication, you publish the file to the web.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;You can also publish a print publication to the web; however, the appearance of the Web pages may differ from the printed publication.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;When Publisher publishes a publication to the web, it creates an HTML representation of each page in the publication, and then saves those HTML files, along with any necessary supporting files, to the specified URL location.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The HTML files that Publisher publishes have no link to the original Publisher file used to generate them. If you later need to make changes to the web pages, do not edit them directly. Rather, make your changes to the original Publisher web publication, and then re-publish the file to the same URL location. Changes made to the HTML directly are not propagated back to the original web publication; indeed, if you do edit the HTML, and later re-publish the Publisher file, your changes are overwritten.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;By default, Publisher treats the first page in the publication as the initial page in your web site. By default, Publisher saves the HTML file representing the first publication page as 'index.htm'. Publisher saves the HTML pages for any other publication pages, as well as any support files (such as image files), in a folder called 'index_file', located in the same directory as the index file. If you do not specify the file name for an HTML file, Publisher generates a name for it automatically.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To determine if a publication is a print or web publication, use the Document.PublicationType property. To convert a print publication to a web publication, or vice versa, use the Document.ConvertPublicationType method. Note that this overwrites the previous version of the file.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To publish a file to the web, use the Document.SaveAs method. For the Format parameter, specify pbFileHTMLFiltered. For the FileName parameter, specify the URL location to which you want to publish the file. This corresponds to choosing the &lt;B&gt;Publish to the Web&lt;/B&gt; command from the &lt;B&gt;File&lt;/B&gt; menu. Note that the .htm file extension is automatically added to the value of the &lt;B&gt;&lt;I&gt;Filename&lt;/I&gt;&lt;/B&gt; parameter if the value of the &lt;B&gt;&lt;I&gt;Format&lt;/I&gt;&lt;/B&gt; parameter is &lt;B&gt;pbFileHTMLFiltered&lt;/B&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;This example saves the active Web publication as a set of filtered HTML pages and supporting files. In this example, Publisher names the HTML file representing the first publication page after the original web publication name. (Note that &lt;I&gt;URLPath&lt;/I&gt; must be replaced with a valid file path for this example to work.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;CODE&gt;&lt;FONT size=2&gt;With ActiveDocument&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;CODE&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;.SaveAs Filename:="&lt;I&gt;URLPath&lt;/I&gt;" &amp;amp; .Name, Format:=pbFileHTMLFiltered&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;CODE&gt;&lt;FONT size=2&gt;End With&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=AlertText&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;B&gt;Note&lt;/B&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;The &lt;B&gt;pbFilePublicationHTML&lt;/B&gt; value of the &lt;B&gt;&lt;I&gt;Format&lt;/I&gt;&lt;/B&gt; parameter represent an HTML file format available in Publisher 2002 that enabled re-importation of the HTML Publisher generated. Because of the resulting large file size, however, this file format has been deprecated and should not be used.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;If you specify pbFileWebArchive for the Format parameter, Publisher generates an .mht file. An .mht file is an HTML file that has all of its support files, such as images and other files, embedded in it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;If you later make changes to the web publication and need to re-publish it, simply use the SaveAs method with the same file path specified. This overwrites the existing HTML files; no warning is given.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To generate a preview of a web publication, use the Document.WebPreview method. This method generates a local HTML copy of the publication, and displays it in the users default browser. The Web preview opens with the active page displayed. Preview Web pages are generated for each page in the publication. However, if the publication is a print publication or otherwise lacks a navigation bar, there may be no way to navigate to those pages.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The following example sets the active page of the publication and generates a Web preview of the publication.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;With ActiveDocument&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;.ActiveView.ActivePage = .Pages(2)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;.WebPagePreview&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Code&gt;&lt;CODE&gt;&lt;FONT size=2&gt;End With&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;Publisher 2003 includes pre-defined web navigation bars that you can include in your Web publication. For more information on how to use web navigation bars programmatically, see &lt;/FONT&gt;&lt;A href="http://www.msdn.microsoft.com/office/understanding/publisher/articles/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/odc_pb_navbarswebpubs.asp"&gt;&lt;FONT face=Verdana size=2&gt;Adding Navigation Bars to Web Publications in Microsoft Office Publisher 2003&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To specify settings for the web publications you create, use the &lt;B&gt;WebOptions&lt;/B&gt; object. This object contains properties that represent settings that newly created Web publication inherit, such as encoding and font options. When you modify any of these settings, any Web publications you create inherit the modified properties.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;For example, if you need to re-publish a large Web publication, you might want to set the &lt;B&gt;EnableIncrementalUpload&lt;/B&gt; to &lt;B&gt;True&lt;/B&gt;. This specifies that only changes made to a publication will be uploaded to the Web server when published, rather than the entire publication. The &lt;B&gt;EnableIncrementalUpload&lt;/B&gt; property applies only to Web publications that have already been published to a Web server. If a Web publication has not already been published to a Web server, the entire publication will be published to the server during the initial publishing process, regardless of whether the &lt;B&gt;EnableIncrementalUpload&lt;/B&gt; property is set to &lt;B&gt;True&lt;/B&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;The &lt;B&gt;WebOptions&lt;/B&gt; object settings are application-level settings specific to each user.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Text&gt;&lt;FONT face=Verdana size=2&gt;To specify web properties for a specific page, use the WebPageOptions object. This object contains properties that represent web characteristics of the specified publication page, such as background sound, page description, and whether to include the page on new web navigation bars. To specify a file name for the HTML file generated from a publication page, use the WebPageOptions.PublishFileName property. As mentioned earlier, specifying a file name for a Web page is optional. When a publication is saved as filtered HTML, Publisher automatically generates file names for any Web page that does not have a file name specified. User defined file names are only used when a publication is saved as filtered HTML. File names must be specified without a file extension.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=411835" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Publisher: 'Using Tags in Publisher' Article Now Live</title><link>http://blogs.msdn.com/andrew_may/archive/2005/01/24/359772.aspx</link><pubDate>Mon, 24 Jan 2005 21:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:359772</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/359772.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=359772</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=359772</wfw:comment><description>&lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;My latest article on programming Publisher, &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/office/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/OfficePublisherUsingTags.asp"&gt;&lt;font face="Verdana" size="2"&gt;Using Tags to Store Custom Information in Publisher 2003 and Publisher 2002&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;, has just been published on &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/"&gt;&lt;font face="Verdana" size="2"&gt;MSDN&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;. As the name states, the article talks about using the &lt;b style="mso-bidi-font-weight: normal"&gt;Tags&lt;/b&gt; collection of the &lt;b style="mso-bidi-font-weight: normal"&gt;Document&lt;/b&gt;, &lt;b style="mso-bidi-font-weight: normal"&gt;Page&lt;/b&gt;, and &lt;b style="mso-bidi-font-weight: normal"&gt;Shape&lt;/b&gt; objects in Publisher to store information, such as custom variables or state information not normally persisted in a Publisher file. You can use the &lt;b style="mso-bidi-font-weight: normal"&gt;Tags&lt;/b&gt; collection to persist a wide range of custom information within your publication, at the publication, page, or shape level. An interesting aspect of the &lt;b style="mso-bidi-font-weight: normal"&gt;Tags&lt;/b&gt; collection is one of the rare pieces of the Publisher object model that doesn't have a counterpart in the application's user interface.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;If you've been reading my Publisher blog entries, you got a preview of the information in the article &lt;/font&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/10/29/249671.aspx"&gt;&lt;font face="Verdana" size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;, &lt;/font&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/10/29/249755.aspx"&gt;&lt;font face="Verdana" size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;, and &lt;/font&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/10/31/250329.aspx"&gt;&lt;font face="Verdana" size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;. But this article builds on that material and is worth a look even if you've read those entries.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;I'm pretty happy with how this one turned out, especially the in-depth examples using catalog merge. I knew that when you perform a catalog merge, all the shapes in the catalog merge area are copied for each record. What I found out was, this includes any tags you've assigned to those shapes. Which lets you do some very interesting things, like embedding merge data source information within the shapes of the finished merge publication. &lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Go take a look.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=359772" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category></item><item><title>Publisher: Formatting Text Across Multiple Text Boxes, or in the Overflow Buffer</title><link>http://blogs.msdn.com/andrew_may/archive/2004/11/22/268065.aspx</link><pubDate>Mon, 22 Nov 2004 19:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:268065</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/268065.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=268065</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=268065</wfw:comment><description>&lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Here's an interesting quirk in Publisher's object model. It's by design, and it makes sense if you think about it. But it may lead to some unexpected results if you don't take it into account. I didn't, and it did, so I thought I'd point it out.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;First, start out with a text box that's small enough that not all the text displays:&lt;/font&gt;&lt;/p&gt;&lt;img src="http://www.officezealot.com/john/Pub_ResizeText_blog_1.gif" /&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Then, programmatically decrease the text font size:&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;ThisDocument.Pages(1).Shapes("Example"). _&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp; TextFrame.TextRange.Font.Size = 14&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;You'd expect that all the text in the text box would be set to the new font size, right? Instead, you get this:&lt;/font&gt;&lt;/p&gt;&lt;img src="http://www.officezealot.com/john/Pub_ResizeText_blog_2.gif" /&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;All the text that was showing at the time the code ran is set to the new, smaller font size, thereby leaving space in the text box for more text to display. The additional text displayed, however, is still formatted at the previous, larger, font size.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;This is actually by design. Here's why it happens:&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Publisher lets you link multiple text boxes together, and automatically manages how text flows from one text box to the next. If there isn't room to display all the text in the first text box,&amp;nbsp;the text&amp;nbsp;flows into the second, and so on. If there's too much text to display in the final text box, Publisher stores the text in an &lt;i style="mso-bidi-font-style: normal"&gt;overflow buffer&lt;/i&gt;. That's the case here; there's only one textbox, so any text there isn't room to display is stored in the overflow buffer.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Now, let's look at that line of code again:&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;ThisDocument.Pages(1).Shapes("Example"). _&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp; TextFrame.TextRange.Font.Size = 14&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font size="2"&gt;&lt;font face="Verdana"&gt;In this code, &lt;/font&gt;&lt;span class="CodeEmbedded"&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'"&gt;&lt;font face="Courier New"&gt;TextFrame.TextRange&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana"&gt; returns a &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/vbapb11/HTML/pbobjtextrange.asp"&gt;TextRange&lt;/a&gt;&lt;/b&gt; object that represents the text currently displaying in the text box. Which does not include any of the text stored in the overflow buffer. So only the text showing in the text box at the time the code runs is resized.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;To change the font size on all the text in the example above, you'd want to use the &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/vbapb11/HTML/pbobjstory.asp"&gt;Story&lt;/a&gt;&lt;/b&gt; object. The &lt;b style="mso-bidi-font-weight: normal"&gt;Story&lt;/b&gt; object represents:&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;All the text in an unlinked text frame, including the overflow buffer.&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;All the text flowing between linked text frames, including the overflow buffer.&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;The text in a table cell.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font size="2"&gt;&lt;font face="Verdana"&gt;So, whereas &lt;/font&gt;&lt;span class="CodeEmbedded"&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'"&gt;&lt;font face="Courier New"&gt;TextFrame.TextRange&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana"&gt; represents the text currently displayed in a specific text box, &lt;/font&gt;&lt;span class="CodeEmbedded"&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'"&gt;&lt;font face="Courier New"&gt;Story.TextRange&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana"&gt; represents the entire text of that story, no matter how many text boxes (and the overflow buffer) it currently resides in. Each &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/vbapb11/HTML/pbobjtextframe.asp"&gt;TextFrame&lt;/a&gt;&lt;/b&gt; and &lt;b style="mso-bidi-font-weight: normal"&gt;TextRange&lt;/b&gt; object has a &lt;b style="mso-bidi-font-weight: normal"&gt;Story&lt;/b&gt; property, which lets you access the &lt;b style="mso-bidi-font-weight: normal"&gt;Story&lt;/b&gt; object the text in it belongs to.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Here's the code again, rewritten to change the font size of all the text, both in the text box and overflow buffer:&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font size="2"&gt;ThisDocument.Pages(1).Shapes("Example"). _&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;TextFrame.TextRange.Story.TextRange.Font.Size = 14&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="AlertText" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="mso-no-proof: yes"&gt;Note&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Just be aware when you set story properties, you set them for the entire story, no matter which text box it appears in. If the &lt;b style="mso-bidi-font-weight: normal"&gt;Story&lt;/b&gt; object in the above example flowed through several text boxes, the font size in each would be set to 14.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;There is no object in the Publisher object model that represents the overflow buffer. Each &lt;b style="mso-bidi-font-weight: normal"&gt;TextFrame&lt;/b&gt; does have an &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/vbapb11/HTML/pbprooverflowing.asp"&gt;Overflowing&lt;/a&gt;&lt;/b&gt; property, however, that indicates whether text is overflowing from that text box into the overflow buffer. (For linked text frames, of course, only the final text frame could be overflowing.) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Also, each &lt;b style="mso-bidi-font-weight: normal"&gt;TextFrame&lt;/b&gt; object also has an &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;a href="http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/vbapb11/HTML/pbproAutoFitText.asp"&gt;AutoFitText&lt;/a&gt;&lt;/b&gt; property, which lets you set how you want Publisher to deal with overflowing text:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-no-proof: yes"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Allow the text to overflow&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-no-proof: yes"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Adjust the text frame size to fit the text&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-no-proof: yes"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font size="2"&gt;&lt;font face="Verdana"&gt;Reduce the text size so that the it fits in the text frame&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=268065" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Publisher: Creating a Linked Picture from an Embedded Picture (Part 2 of 2)</title><link>http://blogs.msdn.com/andrew_may/archive/2004/11/08/254169.aspx</link><pubDate>Mon, 08 Nov 2004 23:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:254169</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/254169.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=254169</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=254169</wfw:comment><description>&lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/11/08/254167.aspx"&gt;&lt;font face="Verdana" size="2"&gt;Read Part 1 here&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;In the last entry, I showed you how to write a function that creates a separate .jpg file from a picture embedded in a publication. Now, let's finish the job by replacing the embedded picture with a picture linked to the new .jpg file.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Below is an example of a procedure that may call this function. It specifies the shape from which to create a linked picture, and the location to which to save the resulting picture file. It takes the file path returned from the function and uses it to replace the embedded picture with the newly-created linked picture.&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Sub ReplaceEmbeddedPictureWithLinked()&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim pubShape As Shape&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim PubFileName As String&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim PicFileName As String&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;'Select the embedded picture to create a linked picture from&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Set pubShape = ActiveDocument.Pages(3).Shapes("Picture 5")&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;'Specify the file path to save picture&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;PubFileName = ActiveDocument.FullName&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;'Call function&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;PicFileName = CreatePictureAsFile(pubShape, PubFileName)&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;'Replace embedded picture with linked picture&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;pubShape.PictureFormat.Replace pathname:=PicFileName, _&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;insertas:=pbPictureInsertAsLinked&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;End Sub&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=254169" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Publisher: Creating a Linked Picture from an Embedded Picture (Part 1 of 2)</title><link>http://blogs.msdn.com/andrew_may/archive/2004/11/08/254167.aspx</link><pubDate>Mon, 08 Nov 2004 23:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:254167</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/254167.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=254167</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=254167</wfw:comment><description>&lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;A lot of the time, entries that I post here end up inspiring me so that I expand them into articles that end up on MSDN. This time, I'm doing things the other way around: the next two posts are going to be excerpts from an article I actually published about 8 months ago.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Here's why:&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;The other day a user emailed me, asking how he could 'pull out' an embedded picture from a publication; i.e., he wanted to save the embedded picture as a separate file. This is something that comes up, in email to me and the Publisher newsgroups, fairly regularly. And I've written about how to do it; it's not that tough. Problem is, I wrote about it as a (very minor) part of a 34-page article, which was itself the second in a series of three articles—aimed at commercial printers, no less. Given all that, the chances of him finding the relevant code sample by doing a Web search was pretty small.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;So I'm posting the relevant portions here, in the hopes they'll be a little more 'visible'. These are excerpted from the thrillingly-titled &lt;/font&gt;&lt;a href="http://www.msdn.microsoft.com/office/understanding/publisher/articles/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/odc_pb_prepress2.asp"&gt;&lt;font face="Verdana" size="2"&gt;Automating Commercial Printing Prepress Tasks in Publisher 2003, Part 2&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;. This article really contains a lot of useful information about how to write code that manages the graphics you include in your publications, including code sample on how to:&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-size: 8.0pt"&gt;&lt;font face="Verdana" size="2"&gt;Identify embedded and linked pictures in the publication. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 8.0pt"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-size: 8.0pt"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Generate a list of all pictures that were modified or whose links are broken. &lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 8.0pt"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-size: 8.0pt"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Update linked pictures whose originals were modified. &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 8.0pt"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-size: 8.0pt"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Convert linked pictures to embedded pictures. &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 8.0pt"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-size: 8.0pt"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Save embedded pictures as linked pictures. &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 8.0pt"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-size: 8.0pt"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Replace one picture with another picture. &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 8.0pt"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-size: 8.0pt"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Replace an empty picture frame with a picture. &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 8.0pt"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-size: 8.0pt"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Gather detailed information about a specific picture. &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;So if any of those tasks fit with what you need to do, check it out.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;End of commercial. Back to the task: how do you turn an embedded picture back into its original, separate file?&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;The short answer is, unfortunately, that you can't. However, what you can do is create a new, linked picture file from the embedded picture. There's a number of reasons why you'd want to do this: Using linked pictures instead of embedded pictures not only decreases the file size of a publication but also provides a separate image file that can be edited if necessary, and then updated quickly in Publisher.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Just realize that the resulting linked picture may not be the same format or resolution as the original picture embedded in the publication. This is because Publisher converted the picture twice: once when it embedded the picture, and again when it saved the picture as a separate file. Also, you cannot save an embedded EPS picture as an EPS file.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;The following example creates a linked picture from an embedded one. Currently in the Publisher object model, the &lt;span class="Bold"&gt;&lt;strong&gt;SaveAsPicture&lt;/strong&gt;&lt;/span&gt; method applies only to the &lt;span class="Bold"&gt;&lt;strong&gt;Page&lt;/strong&gt;&lt;/span&gt; object, not individual shapes on a page. The function below creates a publication of the exact same dimensions as the shape passed it. It then pastes the shape onto the publication's single page, and saves the page as a .jpg file. It passes the full file path of the saved JPG file back to the calling procedure.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&amp;nbsp;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Function CreatePictureAsFile(shpEmbeddedPicture As Shape, _&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;strFileName As String) As String&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim pubDocument As Document&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;'Create the new publication&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Set pubDocument = NewDocument&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;'Set the page dimensions to equal&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;'the picture dimensions&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;With pubDocument.PageSetup&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.PageHeight = shpEmbeddedPicture.Height&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.PageWidth = shpEmbeddedPicture.Width&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;End With&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;'Paste the picture into the new publication&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;shpEmbeddedPicture.Copy&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;pubDocument.Pages(1).Shapes.Paste&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;'Position the picture correctly&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;With pubDocument.Pages(1)&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;With .Shapes(1)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Top = 0&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Left = 0&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;End With&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;'Passes file path of picture back to calling procedure&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;CreatePictureAsFile = strFileName &amp;amp; "_" &amp;amp; _&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;shpEmbeddedPicture.Name &amp;amp; ".jpg"&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;'Saves a picture at the specified file path&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.SaveAsPicture Filename:=CreatePictureAsFile&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;End With&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;'Closes Publisher instance without&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;'saving publication created&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;pubDocument.Application.Quit&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;End Function&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/11/08/254169.aspx"&gt;&lt;font face="Verdana" size="2"&gt;Read Part 2 here.&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=254167" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Publisher: Using Tags to Store Custom Properties (Part 3)</title><link>http://blogs.msdn.com/andrew_may/archive/2004/10/31/250329.aspx</link><pubDate>Mon, 01 Nov 2004 01:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:250329</guid><dc:creator>Andrew May</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/250329.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=250329</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=250329</wfw:comment><description>&lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/10/29/249671.aspx"&gt;&lt;font face="Verdana" size="2"&gt;First&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;, I discussed the tags collection, which you can use as generic holding bins for whatever data you want to persists within your publications, pages, or shapes.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/10/29/249755.aspx"&gt;&lt;font face="Verdana" size="2"&gt;Next&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;, I showed you a few examples using document and page-level tags.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;So now, to round things out, let’s look at a short example using tags stored in shapes.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Let go back to the book example I mentioned in the first entry: you’ve created a book, and each chapter is a separate publication. Now, let’s further suppose that within each chapter you’re using textbox shapes for a number of different functions: the main chapter text, but also side-bar stories, pull quotes, figure captions, that kind of thing. Programmatically, there’s no way to tell the function of each textbox shape. Except you used tags to do exactly that. When you created each publication, you added a &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; object to each text box that denoted what you’re using it for. Like so: &lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Activedocument.Selection.ShapeRange(1).Tags.Add "StoryType", "PullQuote"&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;(The above code assigns the tag to the first shape in the ShapeRange you currently have selected in the active document. Obviously, if you’ve only got one shape selected, then that’s shape one.)&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Now, suppose you decide later that you want to change the font you used for all the pull quotes, and bump up the point size while you’re at it. You can quickly create a procedure that identifies all the text boxes containing pull quotes, based on the value of their ‘StoryType’ tag, and makes the appropriate changes.&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Sub FormatPullQuotes()&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim d As Document&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim p As Page&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim s As Shape&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim t As Tag&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;For Each d In Documents&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;For Each p In d.Pages&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;For Each s In p.Shapes&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;If s.Type = pbTextFrame Then&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;For Each t In s.Tags&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;If (t.Name = "StoryType" And t.Value = "PullQuote") Then&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s.TextFrame.TextRange.Font.Name = "Arial"&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;s.TextFrame.TextRange.Font.Size = 20&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;End If&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Next t&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;End If&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Next s&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Next p&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Next d&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;End Sub&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;These examples are fairly basic, but I hope you get the idea of just how useful and flexible &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; objects can be. I’m sure, once you start looking at your own business processes, you’ll see situations where using tags will come in handy.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=250329" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Publisher: Using Tags to Store Custom Information (Part 2)</title><link>http://blogs.msdn.com/andrew_may/archive/2004/10/29/249755.aspx</link><pubDate>Fri, 29 Oct 2004 20:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:249755</guid><dc:creator>Andrew May</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/249755.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=249755</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=249755</wfw:comment><description>&lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;In my last entry, I talked about the &lt;b style="mso-bidi-font-weight: normal"&gt;Tags&lt;/b&gt; collection, which you can use as generic holding bins for whatever data you want to persists within your publications, pages, or shapes. Now let's look at some actual examples.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;So far, the examples I've been able to think up use tags for storing two general types of information:&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Publication, page, or shape attribute information that isn't already stored in any of the available object model properties.&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Variable data that is needed for running some procedure or add-in functionality.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Example Using a Document-Level Tag&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Suppose you've created a catalog of your products, including prices that are subject to change over time. You want to be sure none of your employees prints the catalog for a customer once it's more than three months old. So when you've finished creating the catalog, you add a document tag, called Expiration Date, and set its value to a date 90 days in the future.&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;ActiveDocument.Tags.Add "ExpirationDate", CStr(Now + 90)&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;And then you write an event handler for opening the document. The event handler compares the value of the Expiration Date tag with the current date. If the publication is opened after the expiration date, a dialog box displays advising the user not to print the catalog because the prices may not be accurate anymore.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;(You'd place this event handler in the &lt;b style="mso-bidi-font-weight: normal"&gt;ThisDocument&lt;/b&gt; object module.)&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Private Sub Document_Open()&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;If CDate(ActiveDocument.Tags("ExpirationDate").Value) &amp;lt; Now Then&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MsgBox Prompt:="Prices in this catalog may be out of date." &amp;amp; _&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;vbLf &amp;amp; "Do not release this catalog to a customer" &amp;amp; vbLf &amp;amp; _&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;"without checking that prices are accurate.", _&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Buttons:=vbExclamation, _&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Title:="Expiration Date Passed"&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;End If&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;End Sub&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Example Using a Page-Level Tag&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;By design, when you perform a catalog merge, the publication you create or append with the merge results contains no information about the merge publication or data source used to create it. It has no 'memory' of having been created by a catalog merge.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;But what if you wanted to retain that information in the target publication? Suppose you're building a single publication as a catalog, and you're using catalog merges from several different publication and/or data sources. (Maybe each section of your catalog uses a different data source, or each section has a different layout and so uses a different catalog merge area.) It'd be reasonable to want to know which pages in the publication where created with which data sources and publications, and when.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;The following example uses page-level tags to store this information.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;First, it opens the target publication and records how many pages are in the publication prior to the merge being executed. Then it executes the merge, appending the resulting pages to the target publication. Next, the code adds three tags to each new page created by the merge. These tags contain the following information:&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo2; tab-stops: list .5in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;The data source used in the merge&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo2; tab-stops: list .5in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;The publication that contains the catalog merge area used in the merge&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in 3pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo2; tab-stops: list .5in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Date and time of the merge&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;The code even creates or increments a document-level tag called "No of Merges", which contains the number of merge results that have been appended to the target publication.&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Function ExecuteMergeAndTagPages(filePath As String)&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim d As Document&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim p As Page&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim intPages As Integer&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim i As Integer&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim t As Tag&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Dim TagExists As Boolean&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;TagExists = False&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Set d = Application.Open(filePath)&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;intPages = d.Pages.Count&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;d.Close&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Set d = ActiveDocument.MailMerge.Execute(Pause:=False, _&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Destination:=pbMergeToExistingPublication, _&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Filename:=filePath)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;For i = (intPages + 1) To d.Pages.Count&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Set p = d.Pages(i)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;With p.Tags&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Add "Data Source", ActiveDocument.MailMerge.DataSource.Name&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Add "Merge Pub", ActiveDocument.FullName&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Add "Page Creation Date", CStr(Now)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;End With&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Next i&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;For Each t In d.Tags&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;If t.Name = "No of Merges" Then&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t.Value = t.Value + 1&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;TagExists = True&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;End If&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;Next t&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;o:p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;If TagExists = False Then&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;d.Tags.Add Name:="No of Merges", Value:=1&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;End If&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;End Function&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Once you've stored this information, of course, you can write code that programmatically queries the tags and takes action based on the results. For example, you could write a procedure that deletes all the pages created using a certain data source.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Next time, I'll see if I can't come up with some code samples that use tags at the individual shape level.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=249755" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Publisher: Using Tags to Store Custom Information (Part 1)</title><link>http://blogs.msdn.com/andrew_may/archive/2004/10/29/249671.aspx</link><pubDate>Fri, 29 Oct 2004 17:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:249671</guid><dc:creator>Andrew May</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/249671.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=249671</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=249671</wfw:comment><description>&lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Today I'm going to talk about the &lt;b style="mso-bidi-font-weight: normal"&gt;Tags&lt;/b&gt; collection, a feature in the Publisher object model that hasn't gotten a lot of notice, but is extremely useful when you examine it. (And I'm as guilty as anyone of ignoring it; one of the Publisher testers pointed out tags to me months ago, and it's taken this long for me to start playing around with them.)&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;Tags are, in essence, generic holding bins where you can store whatever information you want to persist with the publication. &lt;span style="mso-bidi-font-weight: bold"&gt;The &lt;b&gt;Tags&lt;/b&gt; collection is a child of the &lt;b&gt;Document&lt;/b&gt;, &lt;b&gt;Page&lt;/b&gt;, and &lt;b&gt;Shape&lt;/b&gt; objects, so you can save data at the publication, page, or individual shape level.&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Each &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; object consists of two properties: a name, and a value. The &lt;b style="mso-bidi-font-weight: normal"&gt;Name&lt;/b&gt; property is simply a string that identifies the tag. The &lt;b style="mso-bidi-font-weight: normal"&gt;Name&lt;/b&gt; property of a &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; must be unique within a given &lt;b style="mso-bidi-font-weight: normal"&gt;Tags&lt;/b&gt; collection. For example, you can't have two &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; objects named "Creation Date" in a single &lt;b style="mso-bidi-font-weight: normal"&gt;Shape&lt;/b&gt; object, but multiple &lt;b style="mso-bidi-font-weight: normal"&gt;Shape&lt;/b&gt; objects could each have a single &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; object named that.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;The &lt;b style="mso-bidi-font-weight: normal"&gt;Value&lt;/b&gt; property of a &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; object is where things get interesting. It's data type is Variant, which means it can store any data type except fixed-length strings. (For more information about the Variant data type, see this &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vadatvariant.asp"&gt;&lt;font face="Verdana" size="2"&gt;reference topic&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;.) So you can store pretty much any kind of information you want, including user-defined types.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Here's another interesting aspect of tags: The &lt;b style="mso-bidi-font-weight: normal"&gt;Tags&lt;/b&gt; collection is one of the rare pieces of the Publisher object model that doesn't have a counterpart in the application's user interface. (The only other instance of this I can think of is &lt;/font&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/02/10/70900.aspx"&gt;&lt;font face="Verdana" size="2"&gt;WizardTags&lt;/font&gt;&lt;/a&gt;&lt;font face="Verdana" size="2"&gt;.) Tags are a totally programmatic feature: you can't get or set &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; objects except through code. So unless you explicitly expose them in the user interface (by displaying them in a dialog box, for example) or the user writes code to find them, the average user isn't going to be aware of them at all. Which makes them an ideal place to store information you don't want the average (that is, non-programming) user to have easy access to.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;To add a &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; object, use the &lt;b style="mso-bidi-font-weight: normal"&gt;Tags.Add&lt;/b&gt; method, which takes the &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; object name and value as parameters:&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;ActiveDocument.Tags.Add "CreationDate", CStr(Now)&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;So what kind of information can you store in tags? Pretty much anything you want. Seriously, the more I play around with tags, the more ideas I get for how to use them. I'm in the process of implementing some of these ideas in code. I'll post code samples as I complete them. For now, consider the following example to get your mind thinking about how you could use Tags in your business processes:&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Suppose you're creating publications for a number of projects. You might want to add a &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; object to each publication to identify which project it's for. So you add a &lt;b style="mso-bidi-font-weight: normal"&gt;Tag&lt;/b&gt; object, named for the project, that has an initial value of "Pending":&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New" size="2"&gt;ActiveDocument.Tags.Add "Farble Project", "InProcess"&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;When the project is done, you change the value to "Complete". Then, you write a procedure that goes through your various work folders once a week and moves any publications where Tag.Value="Complete" to a 'Completed Projects' folder.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Here's the hierarchy of the Tags object model section:&lt;/font&gt;&lt;/p&gt;&lt;img src="http://www.officezealot.com/john/Pub_Tags_blog_1.gif" /&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;In my next few entries, we'll look at examples using Tags at the publication, page, and shape levels. See you then.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=249671" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Publisher: Working with Multiple Open Documents</title><link>http://blogs.msdn.com/andrew_may/archive/2004/10/27/248591.aspx</link><pubDate>Wed, 27 Oct 2004 17:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:248591</guid><dc:creator>Andrew May</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/248591.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=248591</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=248591</wfw:comment><description>&lt;font face="Verdana" size="2"&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;Here's something I didn't notice until I'd been programming with Publisher for awhile:&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;You might have noticed that in Publisher 2003, we added a &lt;b style="mso-bidi-font-weight: normal"&gt;Documents&lt;/b&gt; collection to the &lt;b style="mso-bidi-font-weight: normal"&gt;Application&lt;/b&gt; object. But, you might ask, isn't Publisher a single document interface (SDI) application? If so, shouldn't each open document have its own separate Application object?&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;And you'd be right on all counts. Publisher is indeed an SDI application, so each open document has its own unique Application object that you can use in code. However, the &lt;b style="mso-bidi-font-weight: normal"&gt;Documents&lt;/b&gt; collection is our way of providing you the advantages that come with a multiple document interface (MDI) in the developer environment. It gives you a simple, easy way of identifying and iterating through all the publications open on a system. This especially comes in handy when you're doing the following:&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Moving content between publications&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Performing work on several publications at a time&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;Here's an example of how using the &lt;b style="mso-bidi-font-weight: normal"&gt;Documents&lt;/b&gt; collection simplifies moving content between publications. The code below cuts a shape from the first page of one publication, and then pastes it onto the second page of another publication.&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;Sub MoveFred()&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Documents("Publication1").Pages(1).Shapes("Fred").Cut&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Documents("Publication2").Pages(2).Shapes.Paste&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;End Sub&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;Handling two separate Publisher application is fairly straight-forward. But things can get tricky when you have multiple instances of Publisher open, and you want to coordinate action between them. That's where the &lt;strong&gt;Documents&lt;/strong&gt; collection comes in handy. For instance, suppose you've created a book, and that each chapter is a separate publication. Using the &lt;b style="mso-bidi-font-weight: normal"&gt;Documents&lt;/b&gt; collection, you can easily selected the publications you want to print, in the order you want to print them to produce a complete copy of your book.&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;Sub PrintMyBook()&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;With Documents&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Item("TitlePage").PrintOut&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Item("Chapter1").PrintOut&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;.Item("Chapter2").PrintOut&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;'etc etc&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;End With&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;End Sub&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;Or suppose you want to create a function that iterates through all the publication you have open, and saves copies of any Web publications as HTML into a specific folder:&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;Function SaveOpenPubsAsHTML(FilePath As String)&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;Dim d As Document&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;For Each d In Application.Documents&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;If d.PublicationType = pbTypeWeb Then&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;d.SaveAs Filename:=FilePath &amp;amp; d.Name, _&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Format:=pbFileHTMLFiltered, _&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AddToRecentFiles:=False&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;End If&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Next d&lt;/font&gt;&lt;/p&gt; &lt;p class="Code" style="MARGIN: 0in 0in 3pt"&gt;&lt;font face="Courier New"&gt;End Function&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;(By the way, Publisher automatically adds the .htm file extension to the filename when you set the &lt;b&gt;&lt;i&gt;Format&lt;/i&gt;&lt;/b&gt; parameter to &lt;b&gt;pbFileHTMLFiltered&lt;/b&gt;.)&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;A lot easier than having to keep track of all the individual application instances of Publisher, isn't it?&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=248591" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Code+snippets/default.aspx">Code snippets</category></item><item><title>Publisher: Writing Macros to Save Time and Effort</title><link>http://blogs.msdn.com/andrew_may/archive/2004/10/26/248005.aspx</link><pubDate>Tue, 26 Oct 2004 18:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:248005</guid><dc:creator>Andrew May</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/248005.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=248005</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=248005</wfw:comment><description>&lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Just a quick, shameless plug: &lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Do you have things that you do repeatedly in Publisher? Do you find yourself doing a certain set of tasks over and over again? Wouldn't it be great if you could tell Publisher to perform complicated tasks automatically? Guess what? You can. There's a way to give Publisher detailed instructions on what you want it to do to, when you want it to do it, and even under what conditions, and have Publisher carry out all your instructions automatically.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;You can do all that, and more, by writing macros. And the best part is, writing macros is easy. Give me a few minutes of your time and I'll show you how.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;I've written a series of lessons that teach you what you need to know to start writing macros today. Each self-contained lesson introduces core programming concepts, with plenty of examples and hands-on exercises to show you what we're talking about. You don't need any special experience, just a computer with Publisher installed. After each lesson you'll have learned skills you can start using in your macros right away.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;So why wouldn't you give it a try?&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Here's links to the first four lessons:&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;a href="http://www.msdn.microsoft.com/office/understanding/publisher/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/officepublishermadeeasyone.asp"&gt;&lt;font face="Verdana" size="2"&gt;Lesson One&lt;/font&gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;a href="http://www.msdn.microsoft.com/office/understanding/publisher/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/officepublishermadeeasytwo.asp"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;font face="Verdana" size="2"&gt;Lesson Two&lt;/font&gt;&lt;/b&gt;&lt;/a&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;a href="http://www.msdn.microsoft.com/office/understanding/publisher/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/officepublishermadeeasythree.asp"&gt;&lt;font face="Verdana" size="2"&gt;Lesson Three&lt;/font&gt;&lt;/a&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;a href="http://www.msdn.microsoft.com/office/understanding/publisher/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/officepublishermadeeasyfour.asp"&gt;&lt;font face="Verdana" size="2"&gt;Lesson Four&lt;/font&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=248005" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category></item><item><title>Publisher: Programming Made Easy Article Now Live</title><link>http://blogs.msdn.com/andrew_may/archive/2004/10/06/238928.aspx</link><pubDate>Wed, 06 Oct 2004 22:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:238928</guid><dc:creator>Andrew May</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/andrew_may/comments/238928.aspx</comments><wfw:commentRss>http://blogs.msdn.com/andrew_may/commentrss.aspx?PostID=238928</wfw:commentRss><wfw:comment>http://blogs.msdn.com/andrew_may/rsscomments.aspx?PostID=238928</wfw:comment><description>&lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;The first of my five part series, ‘Programming &lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;st1:mswterms w:st="on"&gt;Microsoft Office&lt;/st1:mswterms&gt; Publisher Made Easy’ went live yesterday. The series consists of five lessons aimed at users who have never coded before, and want some from-the-ground-up assistance in writing powerful, flexible macros using the Publisher object model.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Here’s a list of the content and tentative publish dates for the five articles:&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;a href="http://www.msdn.microsoft.com/office/understanding/publisher/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/officepublishermadeeasyone.asp"&gt;Lesson One&lt;/a&gt;&lt;/span&gt;&lt;/b&gt; (now live&lt;/font&gt;&lt;/font&gt;&lt;font face="Verdana" size="2"&gt;)&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Writing your first macro&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Macro security settings&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Sub procedures&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;a href="http://www.msdn.microsoft.com/office/understanding/publisher/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/officepublishermadeeasytwo.asp"&gt;&lt;strong&gt;Lesson Two&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&amp;nbsp;(now live)&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Object-oriented programming&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Object variables&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Method parameters&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Creating event handlers&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;a href="http://www.msdn.microsoft.com/office/understanding/publisher/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/officepublishermadeeasythree.asp"&gt;Lesson Three&lt;/a&gt;&lt;/span&gt;&lt;/b&gt; (now live)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Creating dialog boxes&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;If…Then statements&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Data variables&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;a href="http://www.msdn.microsoft.com/office/understanding/publisher/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/officepublishermadeeasyfour.asp"&gt;Lesson Four&lt;/a&gt;&lt;/span&gt;&lt;/b&gt; (now live)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Object collections&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;For Each…Next loops&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Nesting code statements&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Indenting code&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana"&gt;&lt;font size="2"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;Lesson Five&lt;/b&gt; (November 2&lt;sup&gt;nd&lt;/sup&gt;)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Return types&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Using the Object Browser&lt;/font&gt;&lt;/p&gt; &lt;p class="BulletedList1" style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="2"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Verdana" size="2"&gt;Using the online help&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;And remember, if you read an article, please take a minute and rate it to let us know what you thought.&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;font face="Verdana" size="2"&gt;Afterwards, if you want some more background on Visual Basic and object-oriented programming, check out these two previous blog entries:&lt;/font&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;span style="mso-bidi-font-size: 11.0pt"&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/09/27/234936.aspx"&gt;&lt;font face="Verdana" size="2"&gt;Publisher Programming Made Easy: Why Program with Objects, Anyway?&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="Text" style="MARGIN: 3pt 0in"&gt;&lt;span style="mso-bidi-font-size: 11.0pt"&gt;&lt;A href="http://blogs.msdn.com/andrew_may/archive/2004/09/28/235325.aspx"&gt;&lt;font face="Verdana" size="2"&gt;Publisher Programming Made Easy: Types of Visual Basic Statements&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=238928" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/andrew_may/archive/tags/Publisher/default.aspx">Publisher</category></item></channel></rss>