Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default Removing Objects

Hi Guy's

I had been using the following code quite nicely and was asked by the
operator of this WB to change the standard formButtons I had on it's
Main Sheet to Command Buttons.

suffice to say, the Kill_Code does not delete the Command Buttons..

Can anyone point me to where I need to add/Insert the
"All.Objects.Delete" code so that there are no buttons left after this
code runs please

As always

TIA

Mick

Sub KillVBCode()

Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent
Dim CodeMod As VBIDE.CodeModule
Dim StartLine As Long
Dim NumLines As Long
Dim ProcName As String
Dim WillRobinson As Integer

WillRobinson = MsgBox("[ DANGER WILL ROBINSON ] YOU ARE ABOUT
TO DELETE ALL VITAL CODES FROM THIS FILE, YA REALLY WANNA DO
THAT..????", vbYesNo)
If WillRobinson = vbYes Then

With Application.VBE
If Not .ActiveCodePane Is Nothing Then
Set .ActiveVBProject =
..ActiveCodePane.CodeModule.Parent.Collection.Pare nt
End If
End With

Call StopTimer

Set VBProj = ActiveWorkbook.VBProject

Set VBComp = VBProj.VBComponents("Module1")
VBProj.VBComponents.Remove VBComp

Set VBComp = VBProj.VBComponents("Module2")
VBProj.VBComponents.Remove VBComp

Set VBComp = VBProj.VBComponents("Module3")
VBProj.VBComponents.Remove VBComp

Set VBComp = VBProj.VBComponents("Module4")
VBProj.VBComponents.Remove VBComp

Set VBComp = VBProj.VBComponents("Module5")
VBProj.VBComponents.Remove VBComp

Set VBComp = VBProj.VBComponents("Module6")
VBProj.VBComponents.Remove VBComp

Rows("1:3").Select
Selection.Delete Shift:=xlUp

For Each VBComp In VBProj.VBComponents
If VBComp.Type = vbext_ct_Document Then
Set CodeMod = VBComp.CodeModule
With CodeMod
.DeleteLines 1, .CountOfLines
End With
Else
VBProj.VBComponents.Remove VBComp
End If

Next VBComp

Else
Cancel = True
End If

Range("A1").Select

SetAttr "T:\Wow Vic\Wow Scheduler\WowSchedHistory - 2013.xls",
vbReadOnly


End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default Removing Objects

False alarm guy's

Seem all I needed to do was go visit Uncle Ron's Website... :)

http://www.rondebruin.nl/controlsobjectsworksheet.htm

Cheers
Mick.

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
removing objects..! via135 via OfficeKB.com Excel Discussion (Misc queries) 2 March 15th 10 05:06 PM
Excel VBA Class Objects - Parent & Successor Objects [email protected] Excel Programming 1 January 15th 07 12:06 AM
Removing Objects Please Help Excel Programming 11 October 19th 06 09:41 PM
Unable to remove Sheet objects in the Microsoft Excel Objects Adrian[_7_] Excel Programming 1 August 26th 04 10:49 PM
Removing objects without unmerging cells No Name Excel Programming 2 May 26th 04 07:21 PM


All times are GMT +1. The time now is 01:44 AM.

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"