Microsoft KB Archive/106250: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
Line 18: Line 18:
-----
-----


WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.


== Word 6.0 for Windows ==
== Word 6.0 for Windows ==
Line 37: Line 37:
The following command prints the contents of the current document to a file.
The following command prints the contents of the current document to a file.


<pre class="FIXEDTEXT">  FilePrint .PrToFileName = &quot;C:\Temp\Filename.ext&quot;, .Type = 0, \  
<pre class="FIXEDTEXT">  FilePrint .PrToFileName = "C:\Temp\Filename.ext", .Type = 0, \  
   .PrintToFile = 1 </pre>
   .PrintToFile = 1 </pre>
If you later want to print the contents of the print file, use the following Copy syntax at the MS-DOS prompt:
If you later want to print the contents of the print file, use the following Copy syntax at the MS-DOS prompt:


<blockquote>'''copy /b &gt;filename&lt; LPT1:'''</blockquote>
<blockquote>'''copy /b &gt;filename&lt; LPT1:'''</blockquote>
For more information on the MS-DOS COPY command, refer to pages 389-393 of the &quot;Microsoft MS-DOS User's Guide and Reference&quot; for MS-DOS version 5.0.
For more information on the MS-DOS COPY command, refer to pages 389-393 of the "Microsoft MS-DOS User's Guide and Reference" for MS-DOS version 5.0.


== Word 2.x for Windows ==
== Word 2.x for Windows ==
Line 50: Line 50:
<pre class="CODESAMP">Sub MAIN
<pre class="CODESAMP">Sub MAIN


SendKeys &quot;C:\Temp\Filename.ext&quot;       'the filename to print to
SendKeys "C:\Temp\Filename.ext"       'the filename to print to
SendKeys &quot;{Enter 2}&quot;                   'Send 2 Returns
SendKeys "{Enter 2}"                   'Send 2 Returns
FilePrint .Type = 0, .PrintToFile = 1
FilePrint .Type = 0, .PrintToFile = 1



Revision as of 09:08, 20 July 2020

Printing to a File Using the WordBasic FilePrint Statement

Q106250



The information in this article applies to:


  • Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
  • Microsoft Windows versions 3.0, 3.1



WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Word 6.0 for Windows

The FilePrint statement in Word 6.0 for Windows includes parameters to allow you to print a document to a file. The FilePrint parameters for printing to a file are listed below.

    .PrintToFile    If 1, sends printer instructions to a file.

   .PrToFileName   If PrintToFile = 1, this parameter specifies the
                   path and filename of the file to print to.

   .AppendPrFile   If PrintToFile = 1, this parameter specifies
                   whether  to overwrite or append to the file if it
                   already exists:

                      0 (zero) Overwrite
                      1        Append 

The following command prints the contents of the current document to a file.

   FilePrint .PrToFileName = "C:\Temp\Filename.ext", .Type = 0, \ 
   .PrintToFile = 1 

If you later want to print the contents of the print file, use the following Copy syntax at the MS-DOS prompt:

copy /b >filename< LPT1:

For more information on the MS-DOS COPY command, refer to pages 389-393 of the "Microsoft MS-DOS User's Guide and Reference" for MS-DOS version 5.0.

Word 2.x for Windows

The FilePrint statement in Word 2.x for Windows does not include a parameter to indicate the print filename (.PrToFileName). To print the contents of the current document to a specific file without being prompted with the filename dialog box, use the SendKeys statement before the FilePrint command. For example:

Sub MAIN

SendKeys "C:\Temp\Filename.ext"        'the filename to print to
SendKeys "{Enter 2}"                   'Send 2 Returns
FilePrint .Type = 0, .PrintToFile = 1

End Sub 

Additional query words: 2.0 6.0 word6 winword winword2

Keywords : kbmacro kbprint kbmacroexample kbofficeprog
Issue type :
Technology :


Last Reviewed: March 28, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.