Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Can code delete code

Thanks for all your help Chip. Much appreciated!!

"Chip Pearson" wrote in message
...
Steph,

The following code will test whether access to the VBProject is
enabled.

Dim Ref As Object
On Error Resume Next
Set Ref = ThisWorkbook.VBProject.References("Excel")
If Ref Is Nothing Then
Debug.Print "No trust"
Else
Debug.Print "trust"
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Steph" wrote in message
...
Chip,
One more question - can I test prior to runtime whether or not
the trusted
source box is checked, and if not prompt a msgbox?

"Chip Pearson" wrote in message
...
Steph,

You can get around the requirement that the Extensibility
library
be set. Declare the VBIDE variables As Object, and replace the
constants that begin with vbext_ with their actual numeric
values.

You can programmatically add a reference to the Extensibility
library with code like


Dim Ref As Object
On Error Resume Next
Err.Clear
Set Ref = ActiveWorkbook.VBProject.References("VBIDE")
If Ref Is Nothing Then
ActiveWorkbook.VBProject.References.AddFromGuid _
GUID:="{0002E157-0000-0000-C000-000000000046}", _
Major:=5, Minor:=3
End If


You cannot programmatically change the "Trust Access To
VBProject" setting. This must be done manually.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Steph" wrote in message
...
Can I ask a follow-up question? From Chip's site, I learned
that the VBA
Extensibility library reference must be set, along with the
Trust access to
VB project check box. Can these be "set" programatically?

"Steph" wrote in message
...
Thanks guys!

"Steph" wrote in message
...
Hello, can any of the following be done, and if so, can
you
please give
an
example of syntax? Thanks!

1. Can code delete an open event procedure?
2. Can code delete an entire module?
3. Can code delete specific lines within a module?
4. CAn code delete an entire sub() within a module?

Thanks again!














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
Delete code chrisnsmith Excel Discussion (Misc queries) 4 March 8th 09 01:10 AM
Code to delete a Line in a another code helmekki[_88_] Excel Programming 1 August 8th 05 01:14 AM
Delete Shortcut with Code zSplash Excel Programming 9 April 10th 04 06:55 PM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM
VBA code to delete VBA code in another Workbook Chip Pearson Excel Programming 0 September 15th 03 03:54 PM


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