<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Fixed Width Text Files</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Mark</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-34966</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Mon, 06 Oct 2008 19:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-34966</guid>
		<description>&lt;p&gt;In my limited experience, it doesn&#039;t seem like the font is significant.  The column width setting seems to adjust for it.  Maybe not.  My problem is that if I have a column at the end with nothing in it, Excel seems to insert the CR/FL at the end of the last column with data.  So I&#039;m asked for a 177 character record, but the last 48 character column (actually 3 or 4 &quot;fields&quot; that are all empty) is empty.  When I look at the .prn file, it appears the CR/LF is at the end of the penultimate column, ignoring the 48 character column.  I don&#039;t know how to insert blanks in there (as opposed to spaces).  I&#039;m just doing this for a non-technical user who can&#039;t tell me for sure if it matters what happens after the last bit of available data or if filling it with spaces is going to cause a problem.  The last &quot;field&quot; is a date field and I don&#039;t know what the import routine does.  Does it just accept the data it&#039;s given and ignore the missing fields?  Does it fail if the record length is too short?  Does it overwrite some field it shouldn&#039;t if it finds a space instead of a blank?&lt;/p&gt;
&lt;p&gt;I was just wondering if there was a way to tell Excel to include 48 blanks, not spaces, before the CR/LF.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>In my limited experience, it doesn&#8217;t seem like the font is significant.  The column width setting seems to adjust for it.  Maybe not.  My problem is that if I have a column at the end with nothing in it, Excel seems to insert the CR/FL at the end of the last column with data.  So I&#8217;m asked for a 177 character record, but the last 48 character column (actually 3 or 4 &#8220;fields&#8221; that are all empty) is empty.  When I look at the .prn file, it appears the CR/LF is at the end of the penultimate column, ignoring the 48 character column.  I don&#8217;t know how to insert blanks in there (as opposed to spaces).  I&#8217;m just doing this for a non-technical user who can&#8217;t tell me for sure if it matters what happens after the last bit of available data or if filling it with spaces is going to cause a problem.  The last &#8220;field&#8221; is a date field and I don&#8217;t know what the import routine does.  Does it just accept the data it&#8217;s given and ignore the missing fields?  Does it fail if the record length is too short?  Does it overwrite some field it shouldn&#8217;t if it finds a space instead of a blank?</p>
<p>I was just wondering if there was a way to tell Excel to include 48 blanks, not spaces, before the CR/LF.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Denise</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-33527</link>
		<dc:creator>Denise</dc:creator>
		<pubDate>Thu, 10 Jul 2008 22:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-33527</guid>
		<description>&lt;p&gt;The fixed text file I need to create has a total of 303 characters so saving as a .prn wraps the last columns to the bottom of the file.&lt;/p&gt;
&lt;p&gt;How do I get around this?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The fixed text file I need to create has a total of 303 characters so saving as a .prn wraps the last columns to the bottom of the file.</p>
<p>How do I get around this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Excel Help</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-31322</link>
		<dc:creator>Excel Help</dc:creator>
		<pubDate>Mon, 17 Mar 2008 18:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-31322</guid>
		<description>&lt;p&gt;Excellent tip. Working with pure text files is often cumbersome because of the lack of formatting.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Excellent tip. Working with pure text files is often cumbersome because of the lack of formatting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt H</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-31077</link>
		<dc:creator>Matt H</dc:creator>
		<pubDate>Mon, 03 Mar 2008 18:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-31077</guid>
		<description>&lt;p&gt;oops, looks like you&#039;ll have to change the amp; to an ampersand to get it to work!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>oops, looks like you&#8217;ll have to change the amp; to an ampersand to get it to work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt H</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-31076</link>
		<dc:creator>Matt H</dc:creator>
		<pubDate>Mon, 03 Mar 2008 18:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-31076</guid>
		<description>&lt;p&gt;The secret is Courier New, size 8.  Do that and it becomes WYSIWIG, and you can save as *.prn to your heart&#039;s content.  I must done this literally tens of thousands of times.&lt;/p&gt;
&lt;p&gt;Here&#039;s a routine I wrote to export the current sheet as a PRN file at the click of a button, without having to navigate through all of the messages Excel hurls at you.&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; ExportPRN()&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;Saves the active sheet is a text file&lt;br&gt;
&lt;/span&gt;&lt;span class=&quot;co1&quot;&gt;&#039;in prn format, without all the nag messages.&lt;br&gt;
&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sPath &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sFileName &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sSheetName &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;Set application settings so that it runs without nag messages&lt;br&gt;
&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt; Application&lt;br&gt;
&#160; .DisplayAlerts = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; .ScreenUpdating = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;Default save location is the same folder as the workbook.&lt;br&gt;
&lt;/span&gt;sPath = ActiveWorkbook.Path&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;If it is a new (unsaved) workbook, save to the Desktop.&lt;br&gt;
&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; sPath = &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; WSHShell &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Object&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; WSHShell = CreateObject(&lt;span class=&quot;st0&quot;&gt;&quot;Wscript.Shell&quot;&lt;/span&gt;)&lt;br&gt;
&#160; &#160; sPath = WSHShell.SpecialFolders(&lt;span class=&quot;st0&quot;&gt;&quot;Desktop&quot;&lt;/span&gt;)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; WSHShell = &lt;span class=&quot;kw1&quot;&gt;Nothing&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;File name will be &quot;Sheet Name.prn&quot;&lt;br&gt;
&lt;/span&gt;sSheetName = ActiveSheet.Name&lt;br&gt;
sFileName = sPath &amp; &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt; &amp; sSheetName &amp; &lt;span class=&quot;st0&quot;&gt;&quot;.prn&quot;&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;Make a duplicate copy of the active sheet to a new workbook&lt;br&gt;
&lt;/span&gt;Sheets(sSheetName).Copy&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;Save the new, single-sheet workbook as a fixed-width text file (*.prn)&lt;br&gt;
&lt;/span&gt;ActiveWorkbook.SaveAs FileName:=sFileName, FileFormat:=xlTextPrinter, CreateBackup:=&lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;Close the workbook without saving&lt;br&gt;
&lt;/span&gt;ActiveWindow.&lt;span class=&quot;kw1&quot;&gt;Close&lt;/span&gt; (&lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;)&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;Restore application settings&lt;br&gt;
&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt; Application&lt;br&gt;
&#160; .DisplayAlerts = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; .ScreenUpdating = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>The secret is Courier New, size 8.  Do that and it becomes WYSIWIG, and you can save as *.prn to your heart&#8217;s content.  I must done this literally tens of thousands of times.</p>
<p>Here&#8217;s a routine I wrote to export the current sheet as a PRN file at the click of a button, without having to navigate through all of the messages Excel hurls at you.</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> ExportPRN()<br />
<span class="co1">&#8216;Saves the active sheet is a text file<br />
</span><span class="co1">&#8216;in prn format, without all the nag messages.<br />
</span><br />
<span class="kw1">Dim</span> sPath <span class="kw1">As</span> <span class="kw1">String</span><br />
<span class="kw1">Dim</span> sFileName <span class="kw1">As</span> <span class="kw1">String</span><br />
<span class="kw1">Dim</span> sSheetName <span class="kw1">As</span> <span class="kw1">String</span></p>
<p><span class="co1">&#8216;Set application settings so that it runs without nag messages<br />
</span><span class="kw1">With</span> Application<br />
&nbsp; .DisplayAlerts = <span class="kw1">False</span><br />
&nbsp; .ScreenUpdating = <span class="kw1">False</span><br />
<span class="kw1">End</span> <span class="kw1">With</span></p>
<p><span class="co1">&#8216;Default save location is the same folder as the workbook.<br />
</span>sPath = ActiveWorkbook.Path</p>
<p><span class="co1">&#8216;If it is a new (unsaved) workbook, save to the Desktop.<br />
</span><span class="kw1">If</span> sPath = <span class="st0">&#8220;&#8221;</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> WSHShell <span class="kw1">As</span> <span class="kw1">Object</span><br />
&nbsp; &nbsp; <span class="kw1">Set</span> WSHShell = CreateObject(<span class="st0">&#8220;Wscript.Shell&#8221;</span>)<br />
&nbsp; &nbsp; sPath = WSHShell.SpecialFolders(<span class="st0">&#8220;Desktop&#8221;</span>)<br />
&nbsp; &nbsp; <span class="kw1">Set</span> WSHShell = <span class="kw1">Nothing</span><br />
<span class="kw1">End</span> <span class="kw1">If</span></p>
<p><span class="co1">&#8216;File name will be &#8220;Sheet Name.prn&#8221;<br />
</span>sSheetName = ActiveSheet.Name<br />
sFileName = sPath &amp;amp; <span class="st0">&#8220;&#8221;</span> &amp;amp; sSheetName &amp;amp; <span class="st0">&#8220;.prn&#8221;</span></p>
<p><span class="co1">&#8216;Make a duplicate copy of the active sheet to a new workbook<br />
</span>Sheets(sSheetName).Copy</p>
<p><span class="co1">&#8216;Save the new, single-sheet workbook as a fixed-width text file (*.prn)<br />
</span>ActiveWorkbook.SaveAs FileName:=sFileName, FileFormat:=xlTextPrinter, CreateBackup:=<span class="kw1">False</span></p>
<p><span class="co1">&#8216;Close the workbook without saving<br />
</span>ActiveWindow.<span class="kw1">Close</span> (<span class="kw1">False</span>)</p>
<p><span class="co1">&#8216;Restore application settings<br />
</span><span class="kw1">With</span> Application<br />
&nbsp; .DisplayAlerts = <span class="kw1">True</span><br />
&nbsp; .ScreenUpdating = <span class="kw1">True</span><br />
<span class="kw1">End</span> <span class="kw1">With</span></p>
<p><span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Maxey</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-31032</link>
		<dc:creator>Dan Maxey</dc:creator>
		<pubDate>Fri, 29 Feb 2008 23:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-31032</guid>
		<description>&lt;p&gt;I&#039;m still a big fan of separating &quot;my&quot; users from &quot;their&quot; data...  meaning that I would employ a user form to input the data.  All error checking is complete before the user can exit the form.   If a cell in a column needs to be 50 characters, then the form will not let them enter more than that.   If they enter less than 50 characters, then the code behind the form does the required string padding.  We get the added benefit of being able to do any other needed error checking at that time too.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;m still a big fan of separating &#8220;my&#8221; users from &#8220;their&#8221; data&#8230;  meaning that I would employ a user form to input the data.  All error checking is complete before the user can exit the form.   If a cell in a column needs to be 50 characters, then the form will not let them enter more than that.   If they enter less than 50 characters, then the code behind the form does the required string padding.  We get the added benefit of being able to do any other needed error checking at that time too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-31024</link>
		<dc:creator>Thomas</dc:creator>
		<pubDate>Fri, 29 Feb 2008 14:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-31024</guid>
		<description>&lt;p&gt;I&#039;ve done this many times in the past. I would also format the worksheet with a fixed width font like courier and supply the first three rows with Hundreds (99 space 1, 99 space 2, ect), Tens (9 spaces 1, 9 spaces 2, ect), Units (12345678901234567890). This aided as a check for proper alignment.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;ve done this many times in the past. I would also format the worksheet with a fixed width font like courier and supply the first three rows with Hundreds (99 space 1, 99 space 2, ect), Tens (9 spaces 1, 9 spaces 2, ect), Units (12345678901234567890). This aided as a check for proper alignment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Williams</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-31007</link>
		<dc:creator>Rick Williams</dc:creator>
		<pubDate>Thu, 28 Feb 2008 23:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-31007</guid>
		<description>&lt;p&gt;@Nick:&lt;br&gt;
I have used the same technique with *.prn files.  The only issue we had was with not checking that all data in long files conforms to the field widths (e.g. a 10 character value in an 8 character field gets truncated) - though I suppose all three of the above techniques will have issues with this.  One advantage of Dick&#039;s method is that the cell will return a &quot;#VALUE&quot; error, which I suppose is at least easy to spot..&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Nick:<br />
I have used the same technique with *.prn files.  The only issue we had was with not checking that all data in long files conforms to the field widths (e.g. a 10 character value in an 8 character field gets truncated) &#8211; though I suppose all three of the above techniques will have issues with this.  One advantage of Dick&#8217;s method is that the cell will return a &#8220;#VALUE&#8221; error, which I suppose is at least easy to spot..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fixed Width Text Files &#124; MS Office Security Watch</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-31001</link>
		<dc:creator>Fixed Width Text Files &#124; MS Office Security Watch</dc:creator>
		<pubDate>Thu, 28 Feb 2008 20:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-31001</guid>
		<description>&lt;p&gt;[...] Fixed Width Text Files automation blogroll book list bugs dose dose of excel downloads files fixed width text printing [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Fixed Width Text Files automation blogroll book list bugs dose dose of excel downloads files fixed width text printing [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Hodge</title>
		<link>http://www.dailydoseofexcel.com/archives/2008/02/28/fixed-width-text-files/#comment-30998</link>
		<dc:creator>Nick Hodge</dc:creator>
		<pubDate>Thu, 28 Feb 2008 19:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1814#comment-30998</guid>
		<description>&lt;p&gt;I&#039;m guessing this is another route. When I need a fixed width text file I just set the column widths to the number of characters I need (even if this hides some of my proportional font data) and then save the sheet as a space delimited *.prn file. Or am I missing something?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;m guessing this is another route. When I need a fixed width text file I just set the column widths to the number of characters I need (even if this hides some of my proportional font data) and then save the sheet as a space delimited *.prn file. Or am I missing something?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

