View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Paul Robinson Paul Robinson is offline
external usenet poster
 
Posts: 208
Default SAVING A COPY OF WORKBOOK W/O THE CODE IN IT

Hi,
This will create a new workbook and copy the active sheet of your
workbook containing the code to it. ThisWorkBook is VBA speak for the
workbook that contains the code

Public Sub MakeNewBook()
Dim FreshWorkBook As New Workbook 'workbook created
Application.ScreenUpdating = False 'speed things up

Set FreshWorkBook = Workbooks.Add
With FreshWorkBook
ThisWorkbook.Activesheet.Copy befo=.Sheets(1)
.Protect Password:="mypassword" 'optional
End With
End Sub

Your new workbook is now active and you can save as...

regards
Paul
"gr8guy" wrote in message ...
Hi,

Suppose i hv a workbook with code in to generate Unique alphanumeric no
e.g. a unique Receipt voucher # for a Receipt voucher workbook which anybody
can save a copy & print.
I want to save the workbook as another workbook with only the copy of the
selected worksheet e.g Sheet1