View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ram Ram is offline
external usenet poster
 
Posts: 138
Default Move / copy worksheet without any changes to the page setup

Hi,

I've got code to copy worksheets as individual files, however, once the code
is executed and i've got individual files, the page setup is not the same as
the original.

code is below

Sub TEST()
Dim NB, MB As Workbook
Set MB = ThisWorkbook
Dim I, II As Long
For I = 1 To MB.Sheets.Count
Set NB = Workbooks.Add
MB.Sheets(I).Cells.Copy NB.Sheets(1).Range("A1")
NB.Sheets(1).Name = MB.Sheets(I).Name
For II = 2 To NB.Sheets.Count
Application.DisplayAlerts = False
NB.Sheets(2).Delete
Application.DisplayAlerts = True
Next
ActiveWindow.DisplayGridlines = False
NB.SaveAs "C:" & MB.Sheets(I).Name & ".xls"
NB.SendMail ", "Split files"
NB.Close
Next
End Sub

Can you help add a code here which will retain the page setup (page
orientation and margins)

Also, instead of sending email, is it possible to just save the emails in
drafts folder?

thanks in advance