ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   print and save a single sheet from a workbook using a commandbutt. (https://www.excelbanter.com/excel-programming/316675-print-save-single-sheet-workbook-using-commandbutt.html)

bibio_

print and save a single sheet from a workbook using a commandbutt.
 
Hi all, i would like to be able to save a single sheet from a workbook using
a command_button to a prealocated folder on a harddrive. at the moment it is
saving the whole workbook. i just want to save the sheet. (some code i have)

Private Sub CommandButton1_Click()
Dim namesheet

Sheet1.Range("B1").Value = Sheet7.Range("I11").Value

Sheet8.Range("I11").Value = Sheet1.Range("B1").Value + 1

Sheet1.Range("B1").Value = Sheet7.Range("I11").Value

Sheet7.Range("I11").Value = Sheet8.Range("I11").Value

namesheet = " - " & Sheet8.Range("I11").Value

Sheet7.SaveAs Sheet1.Range("B2").Value & ".xls"

Sheet8.SaveAs Sheet1.Range("B3").Value & namesheet & ".xls"

Sheet8.SaveAs Sheet1.Range("B2").Value & namesheet & ".xls"

Sheet8.PrintPreview

End Sub

i'm new at this so any help would be great.


sujata_ghosh[_5_]

print and save a single sheet from a workbook using a commandbutt.
 

hi,

try out the following

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

or if you want to print some selective part of the page

then use

for example:

Range("B9:M12").Select
Selection.PrintOut Copies:=1, Collate:=True


sujata


--
sujata_ghosh
------------------------------------------------------------------------
sujata_ghosh's Profile: http://www.excelforum.com/member.php...o&userid=16432
View this thread: http://www.excelforum.com/showthread...hreadid=277941



All times are GMT +1. The time now is 11:34 PM.

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