ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Newbie: How to Print by VBA a Single Page in a Worksheet (https://www.excelbanter.com/excel-programming/286039-newbie-how-print-vba-single-page-worksheet.html)

L.A. Lawyer

Newbie: How to Print by VBA a Single Page in a Worksheet
 
I want to create a VBA snippet that will only print a single named page in a
worksheet to a txt file called "c:\info\excel.txt".

How is that done?



Dave Peterson[_3_]

Newbie: How to Print by VBA a Single Page in a Worksheet
 
One way is to copy the sheet to a new workbook and save it from there, then
close that workbook:

Option Explicit
Sub testme01()

ActiveSheet.Copy 'to a new workbook

With ActiveWorkbook
.SaveAs Filename:="c:\info\excel.txt", FileFormat:=xlText
.Close savechanges:=False
End With

End Sub



"L.A. Lawyer" wrote:

I want to create a VBA snippet that will only print a single named page in a
worksheet to a txt file called "c:\info\excel.txt".

How is that done?


--

Dave Peterson



All times are GMT +1. The time now is 03:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com