Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
G G is offline
external usenet poster
 
Posts: 52
Default How To Remove VBA Code For Distribution of an Excel Sheet

I am currently using Excel 2003. I have written some VBA Code in a worksheet.

I have 2 worksheet. The 1s worksheet is required by users to see and use,
and the 2nd worksheet is not required by the user, but I need it for my VBA
code and other things.

Is there a way to distribute my excel sheet such that others will not be
able to see my code or 2nd worksheet?? 1st of all, I would like the VBA
code to be not available to my users to see. If I can I would like the 2nd
worksheet not available for them to see either. The removal of the VBA code
is more important to me.

I would appreciate any help you can offer.


Thank You,

G
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default How To Remove VBA Code For Distribution of an Excel Sheet

The answer is yes. Now, depending on where your VBA code resides will
depend on how you do what you want to do.

1. If the code resides in a public code module (these are the ones named
Module1,
Module2, etc. in the Project pane of the VB editor window.) then it is
pretty simple.
Set newWB = Sheets("Sheet1").Copy
ActiveWorkbooik.SaveAs Filename:="<giveitanewname .xls"
The sheets.copy method creates a new workbook with one worksheet and
does not
copy the code from the public module.

2. If the code resides in the Worksheet code module you have two things
to consider.
a. Will the worksheet be useful to the user without the code?
b. Will removing the code from the worksheet code module affect the
data?

If 2.a is Yes and 2.b is No, then:

Set newWB = Workbooks.Add
Workbooks(1).Sheets("Sheet1").Cells.Copy neWB
newWB.Sheets(1).Range("A1")
This method copies formulas and formats as well as the data, but does
not bring over
any code from VBA. If you do not want formulas and format, then use
PasteSpecial.



"G" wrote in message
...
I am currently using Excel 2003. I have written some VBA Code in a
worksheet.

I have 2 worksheet. The 1s worksheet is required by users to see and use,
and the 2nd worksheet is not required by the user, but I need it for my
VBA
code and other things.

Is there a way to distribute my excel sheet such that others will not be
able to see my code or 2nd worksheet?? 1st of all, I would like the VBA
code to be not available to my users to see. If I can I would like the
2nd
worksheet not available for them to see either. The removal of the VBA
code
is more important to me.

I would appreciate any help you can offer.


Thank You,

G



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 461
Default How To Remove VBA Code For Distribution of an Excel Sheet

If you have not put any code in the code module behind the first
worksheet, right click on the sheet tab, choose Move or Copy, select New
Workbook, check Create a Copy, and click Enter. The result is a
one-worksheet workbook with only the sheet you want and no code.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 5/27/2010 4:30 PM, G wrote:
I am currently using Excel 2003. I have written some VBA Code in a worksheet.

I have 2 worksheet. The 1s worksheet is required by users to see and use,
and the 2nd worksheet is not required by the user, but I need it for my VBA
code and other things.

Is there a way to distribute my excel sheet such that others will not be
able to see my code or 2nd worksheet?? 1st of all, I would like the VBA
code to be not available to my users to see. If I can I would like the 2nd
worksheet not available for them to see either. The removal of the VBA code
is more important to me.

I would appreciate any help you can offer.


Thank You,

G

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copied from web page to excel sheet and cant remove from sheet mitch Excel Worksheet Functions 2 May 4th 10 07:58 PM
copied from web page to excel sheet and cant remove from sheet mitch Excel Worksheet Functions 0 May 4th 10 05:38 PM
Remove VB code when copying sheet to new workbook Tucker Excel Programming 2 April 15th 09 07:29 AM
Remove VB code from a sheet IT_roofer Excel Programming 4 June 5th 07 07:45 PM
tips for organizing code for distribution Eric[_27_] Excel Programming 0 May 29th 05 10:11 PM


All times are GMT +1. The time now is 09:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"