Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
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! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
Steph,
See www.cpearson.com/excel/vbe.htm for details and example code. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "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! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
Everything you wanted to know about programming to the VBE...
http://www.cpearson.com/excel/vbe.htm -- HTH... Jim Thomlinson "Steph" wrote: 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! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
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! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
Thanks "Guy" would be more appropriate. I just pointed you to Chips site.
That being said I should hit Chip up for a referal fee. I send people to his site a lot... ;-) -- HTH... Jim Thomlinson "Steph" wrote: 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! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
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! |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
Trusted sources is a security setting so that is a big fat no...
Extensibility is a reference so there is no need to use code to add the reference via code. The only time you would need this would be if the code that your code is writing requires a reference to an external library. Is that your question? -- HTH... Jim Thomlinson "Steph" wrote: 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! |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
Basically I am writing code that others will be using. So I didn't want it
to error out if the user didn't have the appropriate security settings and references set. "Jim Thomlinson" wrote in message ... Trusted sources is a security setting so that is a big fat no... Extensibility is a reference so there is no need to use code to add the reference via code. The only time you would need this would be if the code that your code is writing requires a reference to an external library. Is that your question? -- HTH... Jim Thomlinson "Steph" wrote: 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! |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
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! |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
Great. Thanks so much Chip.
"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! |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
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! |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can code delete code
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete code | Excel Discussion (Misc queries) | |||
Code to delete a Line in a another code | Excel Programming | |||
Delete Shortcut with Code | Excel Programming | |||
VBA code delete code but ask for password and unlock VBA protection | Excel Programming | |||
VBA code to delete VBA code in another Workbook | Excel Programming |