SAVING A COPY OF WORKBOOK W/O THE CODE IN IT
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 & not other sheets in the original workbook & OFCOURSE, I donot want the code written in original workbook to also get saved in the copies. I am having trouble using the function SaveAscopy in VBA as it saves exactly a duplicate copy of the original workbook along with the code. bcos of which each file has the original BIG filesize which i donot want. is there a way to copy the contents of Sheet1 original workbook as a new workbook with ONLY Sheet1 & without the code written inside. Can I use .Copy to copy Selected contents of Worksheet1 of original workbook as a new SMALL (KByte) size workbook with only workSheet1 & not with the code written so that nobody else can use the new workbook to generate his own autonumber but will have to use the original workbook to generate the next unique aplhanumeric number . Pls note that the coding is given in the POSTing "Unique Generated Alphanumeric no.". any help to help me to improve the code will be really appreciated, as i knw that i have md a lot of errors & want them rectified before i can use it ofc to generate their own unique receipt voucher. Thanks & regards Eijaz --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004 |
SAVING A COPY OF WORKBOOK W/O THE CODE IN IT
You can try to remove the modules from the workbook, after you save the
workbook with SaveAs method, or you can try to create a new workbook and copy the selected sheets to the new wb. --- Message posted from http://www.ExcelForum.com/ |
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 |
All times are GMT +1. The time now is 01:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com