MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 3rd, 2002, 07:24 AM   #1
johnou
New Member
 
Join Date: Feb 2002
Posts: 4
Default

I would like to send out the current Excel file without the VBA coding because it contains system password etc. Is that any way I can do that?

Thanks,

John
johnou is offline   Reply With Quote
Old Mar 3rd, 2002, 09:16 AM   #2
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,065
Default

HI--

I do not know of such a way, password portect the modules if macros there, but thats no very safe for advanced users, bit like car raido and wondow left open!

or copy the sheet to new work book and mail that so VBA will not be attached

This assumes the VBA is not needed of cause


__________________
Free Excel based Web Toolbar available here.

Jack in the UK
J & R Excel Solutions
"making Excel work for you"
Jack in the UK is offline   Reply With Quote
Old Mar 4th, 2002, 12:02 AM   #3
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-03-03 06:24, johnou wrote:
I would like to send out the current Excel file without the VBA coding because it contains system password etc. Is that any way I can do that?

Thanks,

John
Hi John, if you want to remove all code from a workbook then you try this.

Run this routine with the workbook that
you want to delete code from open... don't
worry if you have other workbooks open
it will prompt you to OK the deletion.

You don't have to referene the Libray files
This is automatically taken care of.

Option Explicit

'*****************************************************************************
'* This procedure removes all code and related structures from a workbook.
'*
'* Reference to the VB Extensibility library is Automatically set when
'* 1st run via the GUID routine.
'*
'* Removes from Workbooks all:
'* Regular modules = vbext_ct_StdModule
'* Class modules = vbext_ct_ClassModule
'* Userforms = vbext_ct_MSForm
'* Code in sheet and workbook modules = vbext_ct_Document
'* Non built-in references
'* Excel 4 macro sheets
'* Dialog sheets
'*
''

Sub RunThisFirst()
On Error Resume Next 'if it already exits
ThisWorkbook.VBProject.References.AddFromGuid _
"{0002E157-0000-0000-C000-000000000046}", 5, 0
TellUser
RemoveAllCode
End Sub

Sub RemoveAllCode()
'XL2K:
'Dim VBComp As VBComponent, AllComp As VBComponents, ThisProj As VBProject
'XL97 & XL2K:
Dim VBComp As Object, AllComp As Object, ThisProj As Object
Dim ThisRef As Reference, WSht As Worksheet, Dlg As DialogSheet
Dim RemoveOK As Integer, Wbk As Workbook

For Each Wbk In Workbooks
If Wbk.Name <> ThisWorkbook.Name Then
'Ask the User Just in case!
RemoveOK = MsgBox("Remove All code from:= " & Wbk.Name & "?", vbYesNo)
If RemoveOK = vbNo Then GoTo Nxt
Set ThisProj = Wbk.VBProject
Set AllComp = ThisProj.VBComponents

For Each VBComp In AllComp
With VBComp
Select Case .Type
Case 1, 2, 3
'remove modules,Classes & Forms
AllComp.Remove VBComp
Case 100
'Remove Event codes
.CodeModule.DeleteLines 1, .CodeModule.CountOfLines
End Select
End With
Next
'remove References to other projects
For Each ThisRef In ThisProj.References
If Not ThisRef.BuiltIn Then ThisProj.References.Remove ThisRef
Next
End If

Set ThisProj = Nothing
Set AllComp = Nothing

Application.DisplayAlerts = False

'Remove Excel4 Macrosheets
For Each WSht In Wbk.Excel4MacroSheets
WSht.Delete
Next

'remove Dialog sheets-note dialogstypically hidden
For Each Dlg In Wbk.DialogSheets
Dlg.Delete
Next

Application.DisplayAlerts = True

Nxt: Next

MsgBox "Done!" & Space(20), vbInformation + vbSystemModal

End Sub

Sub TellUser()
Dim msg As String
Dim Proceed As Integer

msg = "This routine will delete ALL Code" & vbCr
msg = msg & "from ALL currently open workbooks!" & vbCr
msg = msg & "If you do not want to delete them then" & vbCr
msg = msg & "answer NO at the prompt to delete the code." & vbCr & vbCr
msg = msg & "To start this routine click YES" & vbCr
msg = msg & "To cancel this routine Click NO" & vbCr

Proceed = MsgBox(msg, vbInformation + vbYesNo, "Proceed")
If Proceed = vbNo Then End
End Sub

HTH

Ivan
Ivan F Moala is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:52 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes