<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Printing the INFOPATH Form 2003 using VB Script</title><link>https://www.infopathdev.com:443/forums/thread/41428.aspx</link><pubDate>Fri, 08 May 2009 13:18:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:41428</guid><dc:creator>smate</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/41428.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=41428</wfw:commentRss><description>&lt;p&gt;I am trying to create a PDF file using the printer macro, I am getting error expected statement. Code attached below.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sub Print_OnClick() &lt;/p&gt;
&lt;p&gt;&amp;#39; Write your code here &lt;/p&gt;
&lt;p&gt;Dim fileName1 &lt;/p&gt;
&lt;p&gt;Dim nameNode1 &lt;/p&gt;
&lt;p&gt;&amp;#39;Set the values. Replace &amp;quot;/my:myFields/my:textField&amp;quot; with the xpath to the field that has the value you want as the file name &lt;/p&gt;
&lt;p&gt;nameNode1 = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/my:myFields/my:LabNumber&amp;quot;, NamespaceManager) &lt;/p&gt;
&lt;p&gt;fileName1 = nameNode1.Value + &amp;quot;.pdf&amp;quot; &lt;/p&gt;
&lt;p&gt;ActivePrinter = &amp;quot;PDF995&amp;quot; &lt;/p&gt;
&lt;p&gt;Application.PrintOut FileName:=fileName1, Range:=wdPrintAllDocument, Item:= wdPrintDocumentContent, Copies:=1, Pages:=&amp;quot;&amp;quot;, PageType:=wdPrintAllPages, Collate:=True, Background:=True, &lt;/p&gt;
&lt;p&gt;PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0 &lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;</description></item></channel></rss>