<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>All Things VB</title>
	<atom:link href="http://www.allthingsvb.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.allthingsvb.com</link>
	<description>Just another Visual Basic weblog</description>
	<lastBuildDate>Thu, 25 Jun 2009 11:40:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Print from MSWord to PDF, PNG, JPEG, BMP, PCX, TIF, PS, EPS, TXT, PDF, PSD, PCL or RAW, using Visual Basic 6</title>
		<link>http://www.allthingsvb.com/?p=9</link>
		<comments>http://www.allthingsvb.com/?p=9#comments</comments>
		<pubDate>Tue, 16 Jun 2009 15:54:38 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Classic Visual Basic]]></category>
		<category><![CDATA[VBA for Microsoft Word]]></category>

		<guid isPermaLink="false">http://www.allthingsvb.com/?p=9</guid>
		<description><![CDATA[So you want to print output from Visual Basic to a file.  Easy&#8230;
Install PDFCreator, it&#8217;s open source and free!
The VB Code you need is below, The parameters to use are
&#8216;+- [OutputTypes] &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+
&#8216; &#8220;AutosaveFormat&#8221; &#8211; Format Values:
&#8216; 0 = PDF 1 = PNG 2 = JPEG
&#8216; 3 = BMP 4 = PCX 5 = TIFF
&#8216; 6 [...]]]></description>
			<content:encoded><![CDATA[<p>So you want to print output from Visual Basic to a file.  Easy&#8230;<br />
Install PDFCreator, it&#8217;s open source and free!</p>
<p>The VB Code you need is below, The parameters to use are</p>
<blockquote><p>&#8216;+- [OutputTypes] &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
&#8216; &#8220;AutosaveFormat&#8221; &#8211; Format Values:<br />
&#8216; 0 = PDF 1 = PNG 2 = JPEG<br />
&#8216; 3 = BMP 4 = PCX 5 = TIFF<br />
&#8216; 6 = PS 7 = EPS 8 = TXT<br />
&#8216; 9 = PDF/A-1b 10 = PDF/X 11 = PSD<br />
&#8216; 12 = PCL 13 = RAW<br />
&#8216;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
&#8216;+-[sPath]&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
Input and Output Folder Path<br />
&#8216;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
&#8216;+-[sDoc]&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
Input doument name without file type, for this example a Word Document<br />
Warning: if your output file name looks like this [file..],<br />
PDFCreator will write output as [file.pdf] the second[.] is dropped<br />
&#8216;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+</p></blockquote>
<blockquote><p>Private Sub PrintReport( sPath As String, sDoc As String, Output As Integer)</p>
<p>&#8216;PDF Creator Classes<br />
Dim oPDFC As PDFCreator.clsPDFCreator<br />
Dim oPDFE As PDFCreator.clsPDFCreatorError<br />
Dim strPDFPrinter As String<br />
Dim strPrinter As String<br />
Dim oPrinter As Printer<br />
Dim oArray() As String<br />
Dim lPnt As Long<br />
Dim lArray As Long</p>
<p>On Error Resume Next</p>
<p>Dim oWord As Word.Application<br />
Dim oDoc As Word.Document</p>
<p>Set oWord = New Word.Application<br />
Set oDoc = oWord.Documents.Add(App.Path &amp; sDoc)</p>
<p>&#8216;Find PDF Printer<br />
strPDFPrinter = &#8220;&#8221;<br />
For Each oPrinter In Printers<br />
If oPrinter.DeviceName = &#8220;PDFCreator&#8221; Then<br />
strPDFPrinter = oPrinter.DeviceName &amp; &#8221; on &#8221; &amp; oPrinter.Port<br />
End If<br />
Next</p>
<p>&#8216;Ceate PDF Objects<br />
Set oPDFC = CreateObject(&#8221;PDFCreator.clsPDFCreator&#8221;)</p>
<p>With oPDFC<br />
.cStart &#8220;/NoProcessingAtStartup&#8221;, True<br />
.cOption(&#8221;UseAutosave&#8221;) = 1<br />
.cOption(&#8221;UseAutosaveDirectory&#8221;) = 1<br />
.cOption(&#8221;AutosaveDirectory&#8221;) = App.Path &amp; &#8220;\&#8221;<br />
.cOption(&#8221;AutosaveFilename&#8221;) = sDoc<br />
.cOption(&#8221;AutosaveFormat&#8221;) = Output &#8216; 0 = PDF<br />
.cClearCache<br />
End With</p>
<p>&#8216;Save Current Printer &amp; PrintOut<br />
oPDFC.cPrinterStop = True<br />
With oDoc<br />
strPrinter = .Application.ActivePrinter<br />
.Application.ActivePrinter = strPDFPrinter<br />
.PrintOut<br />
End With</p>
<p>&#8216;Wait until the print job has entered the print queue<br />
Do Until oPDFC.cCountOfPrintjobs &gt; 0<br />
DoEvents<br />
Loop</p>
<p>&#8216;Wait until the print job has entered the print queue<br />
oPDFC.cPrinterStop = False<br />
Do Until oPDFC.cCountOfPrintjobs = 0<br />
DoEvents<br />
Loop</p>
<p>&#8216;Destroy PDF Objects<br />
Set oPDFC = Nothing</p>
<p>&#8216;Reset Active Printer<br />
oWord.Application.ActivePrinter = strPrinter</p>
<p>oDoc.Close False<br />
Set oDoc = Nothing<br />
oWord.Quit<br />
Set oWord = Nothing</p>
<p>End Sub</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.allthingsvb.com/?feed=rss2&amp;p=9</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brave new world!</title>
		<link>http://www.allthingsvb.com/?p=1</link>
		<comments>http://www.allthingsvb.com/?p=1#comments</comments>
		<pubDate>Sun, 14 Jun 2009 13:11:32 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Not categorised]]></category>

		<guid isPermaLink="false">http://www.allthingsvb.com/?p=1</guid>
		<description><![CDATA[Welcome to All Things VB.  Come back often, learn from my mistakes and comment if you must.
]]></description>
			<content:encoded><![CDATA[<p>Welcome to All Things VB.  Come back often, learn from my mistakes and comment if you must.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.allthingsvb.com/?feed=rss2&amp;p=1</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
