Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default How to make VBA code to self-destroy itself?

Hi,
I need to ensure that users keep updating software in VBA. So I need to warn
them, say 1 month in advance and past that, I need to disable their access
to crucial module.
I thought of removing that module. How do I do that programmatically?
TIA
Paul


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default How to make VBA code to self-destroy itself?

Hi Paul
I wouldn't recommend this.
First: Easy to circumvent by an experienced user by disabling this code part
Second: Not sure if you're allowed to do 'deleting' code and the possible
legal consequences.

Bottom line: In Excel there's no real way to protect/secure your code

"count" wrote:

Hi,
I need to ensure that users keep updating software in VBA. So I need to warn
them, say 1 month in advance and past that, I need to disable their access
to crucial module.
I thought of removing that module. How do I do that programmatically?
TIA
Paul



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default How to make VBA code to self-destroy itself?

Thanks Frank,
I still need the answer though.
The app and code are mine and users agree that it's better for them to have
dead application rather than one that lies about tax rebate rates - stuff is
serious!
They can disable that code, you say - that's why I prefer app to castrate
itself. They can still use backup and reimport missing module but in this
case my butt is safe.
So question is still open
Paul

Użytkownik "Frank Kabel" napisał w wiadomości
...
Hi Paul
I wouldn't recommend this.
First: Easy to circumvent by an experienced user by disabling this code
part
Second: Not sure if you're allowed to do 'deleting' code and the possible
legal consequences.

Bottom line: In Excel there's no real way to protect/secure your code

"count" wrote:

Hi,
I need to ensure that users keep updating software in VBA. So I need to
warn
them, say 1 month in advance and past that, I need to disable their
access
to crucial module.
I thought of removing that module. How do I do that programmatically?
TIA
Paul





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to make VBA code to self-destroy itself?

If you must do it, you could hide the sheet, but in VBA you can hid to a
state of xlVeryHidden, which stops them un hiding in Excel itself as it
doesn't even show in the list of hidden worksheets.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"count" wrote in message
...
Thanks Frank,
I still need the answer though.
The app and code are mine and users agree that it's better for them to

have
dead application rather than one that lies about tax rebate rates - stuff

is
serious!
They can disable that code, you say - that's why I prefer app to castrate
itself. They can still use backup and reimport missing module but in this
case my butt is safe.
So question is still open
Paul

Użytkownik "Frank Kabel" napisał w wiadomości
...
Hi Paul
I wouldn't recommend this.
First: Easy to circumvent by an experienced user by disabling this code
part
Second: Not sure if you're allowed to do 'deleting' code and the

possible
legal consequences.

Bottom line: In Excel there's no real way to protect/secure your code

"count" wrote:

Hi,
I need to ensure that users keep updating software in VBA. So I need to
warn
them, say 1 month in advance and past that, I need to disable their
access
to crucial module.
I thought of removing that module. How do I do that programmatically?
TIA
Paul







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to make VBA code to self-destroy itself?

http://groups.google.com/groups?thre...%40tkmsftngp07


''Needs a reference to the VB Extensibility library set
'Removes from active workbook all:
''Regular modules
''Class modules
''Userforms
''Code in sheet and workbook modules
''Non built-in references
''Excel 4 macro sheets
''Dialog sheets
Sub RemoveAllCode()
Dim VBComp As Object, AllComp As Object, ThisProj As Object
Dim ThisRef As Reference, WS As Worksheet, DLG As DialogSheet
Set ThisProj = ActiveWorkbook.VBProject
Set AllComp = ThisProj.VBComponents
For Each VBComp In AllComp
With VBComp
Select Case .Type
Case vbext_ct_StdModule, vbext_ct_ClassModule, _
vbext_ct_MSForm
AllComp.Remove VBComp
Case vbext_ct_Document
.CodeModule.DeleteLines 1, .CodeModule.CountOfLines
End Select
End With
Next
For Each ThisRef In ThisProj.References
If Not ThisRef.BuiltIn Then ThisProj.References.Remove ThisRef
Next
Application.DisplayAlerts = False
For Each WS In Excel4MacroSheets
WS.Delete
Next
For Each DLG In DialogSheets
DLG.Delete
Next
End Sub

above previously posted by Jim Rech.

--
Regards,
Tom Ogilvy

"count" wrote in message
...
Thanks Frank,
I still need the answer though.
The app and code are mine and users agree that it's better for them to

have
dead application rather than one that lies about tax rebate rates - stuff

is
serious!
They can disable that code, you say - that's why I prefer app to castrate
itself. They can still use backup and reimport missing module but in this
case my butt is safe.
So question is still open
Paul

Użytkownik "Frank Kabel" napisał w wiadomości
...
Hi Paul
I wouldn't recommend this.
First: Easy to circumvent by an experienced user by disabling this code
part
Second: Not sure if you're allowed to do 'deleting' code and the

possible
legal consequences.

Bottom line: In Excel there's no real way to protect/secure your code

"count" wrote:

Hi,
I need to ensure that users keep updating software in VBA. So I need to
warn
them, say 1 month in advance and past that, I need to disable their
access
to crucial module.
I thought of removing that module. How do I do that programmatically?
TIA
Paul









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default How to make VBA code to self-destroy itself?

Tom,
Thanks, Danke, Merci!
wwwbwy?! (where will we be without you?)
Paul

Użytkownik "Tom Ogilvy" napisał w wiadomości
...
http://groups.google.com/groups?thre...%40tkmsftngp07


''Needs a reference to the VB Extensibility library set
'Removes from active workbook all:
''Regular modules
''Class modules
''Userforms
''Code in sheet and workbook modules
''Non built-in references
''Excel 4 macro sheets
''Dialog sheets
Sub RemoveAllCode()
Dim VBComp As Object, AllComp As Object, ThisProj As Object
Dim ThisRef As Reference, WS As Worksheet, DLG As DialogSheet
Set ThisProj = ActiveWorkbook.VBProject
Set AllComp = ThisProj.VBComponents
For Each VBComp In AllComp
With VBComp
Select Case .Type
Case vbext_ct_StdModule, vbext_ct_ClassModule, _
vbext_ct_MSForm
AllComp.Remove VBComp
Case vbext_ct_Document
.CodeModule.DeleteLines 1, .CodeModule.CountOfLines
End Select
End With
Next
For Each ThisRef In ThisProj.References
If Not ThisRef.BuiltIn Then ThisProj.References.Remove ThisRef
Next
Application.DisplayAlerts = False
For Each WS In Excel4MacroSheets
WS.Delete
Next
For Each DLG In DialogSheets
DLG.Delete
Next
End Sub

above previously posted by Jim Rech.

--
Regards,
Tom Ogilvy

"count" wrote in message
...
Thanks Frank,
I still need the answer though.
The app and code are mine and users agree that it's better for them to

have
dead application rather than one that lies about tax rebate rates - stuff

is
serious!
They can disable that code, you say - that's why I prefer app to castrate
itself. They can still use backup and reimport missing module but in this
case my butt is safe.
So question is still open
Paul

Użytkownik "Frank Kabel" napisał w wiadomości
...
Hi Paul
I wouldn't recommend this.
First: Easy to circumvent by an experienced user by disabling this code
part
Second: Not sure if you're allowed to do 'deleting' code and the

possible
legal consequences.

Bottom line: In Excel there's no real way to protect/secure your code

"count" wrote:

Hi,
I need to ensure that users keep updating software in VBA. So I need
to
warn
them, say 1 month in advance and past that, I need to disable their
access
to crucial module.
I thought of removing that module. How do I do that programmatically?
TIA
Paul









  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to make VBA code to self-destroy itself?

"count" wrote in message ...
Hi,
I need to ensure that users keep updating software in VBA. So I need to warn
them, say 1 month in advance and past that, I need to disable their access
to crucial module.
I thought of removing that module. How do I do that programmatically?
TIA
Paul


Rather than bothering to unload the xla I would just make sure that
all the functions generate an error, or return #Value, if it is out of
date.

To return #Value use the following:

Public Function FunctionErrVal() As Variant
FunctionErrVal = CVErr(2015)
End Function
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
How do I make a Bar code ??? Wadewild Excel Discussion (Misc queries) 2 June 9th 08 09:08 PM
Destroy command button with a Macro? grasping@straws Excel Discussion (Misc queries) 3 December 22nd 04 02:30 PM
Inserting lines that don't destroy macros Ali K Excel Programming 1 October 27th 04 01:37 PM
Make code more economical Mark C[_5_] Excel Programming 4 October 5th 04 04:06 PM
Seek and destroy [email protected] Excel Programming 7 December 3rd 03 08:41 PM


All times are GMT +1. The time now is 02:11 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"