LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default delete commandbuttons on copied sheet

I have a procedure run by a commandbutton on 1 worksheet that copies
another worksheet to a 3rd worksheet. The procedure then is supposed
to delete the commandbuttons on the newly copied worksheet. It
deletes the 1st one ok but ends in a 1004 error when trying to delete
the 2nd button. What am I doning wrong...thx


here is the code for the deletion of the objects...

Option Compare Text
Dim strMainWks As String
Dim strTmpWks As String
Dim wsCurWks As Worksheet
Dim rSortRange As Range
Dim rMyRange As Range
Dim rMyCell As Range
Dim rMyDeletion As Range


Sub deletebtns_Click()
Dim wsCurWks As Worksheet
Dim Obj As OLEObject
Set wsCurWks = ActiveSheet


For Each Obj In ActiveSheet.OLEObjects

If InStr(1, Obj.ProgId, "CommandButton") < 0 Then
'MsgBox Obj.ProgId
Obj.Delete
End If
Next Obj
End Sub
 
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
copied formulas refer to destination sheet not source sheet Dantron Excel Worksheet Functions 2 October 21st 09 09:51 PM
Delete graphics copied from a Web page Jim Georgia Excel Discussion (Misc queries) 1 October 20th 05 02:47 PM
Delete the formulas of webpage, copied & pasted on excel sheet Mustafa Abedin Excel Discussion (Misc queries) 1 June 19th 05 02:39 PM
Do While, OnTime and CommandButtons John Petty Excel Programming 1 November 23rd 03 12:23 AM
commandbuttons properties Rui[_2_] Excel Programming 2 November 5th 03 04:07 PM


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