View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default how to remove my button

Depends on how the objects were protected when you protected the worksheet.

maybe...

'create a new workbook to email
Sheets("Weekly Time Record").Copy

'remove button and 2nd row in email version
with activesheet
.unprotect password:="topSecRet"
.Shapes.SelectAll
Selection.Delete
.Rows(2).Delete
.protect password:="topSecRet"

If Not fs.FolderExists(DirString) Then
fs.CreateFolder DirString
End If
strFName = "Time Card " & SunDT & " " & USRNM & ".xls"
.Parent.SaveAs DirString & "\" & strFName
end with



DawnTreader wrote:

Hello

here is an additional question. will code crap out on a protected worksheet?
this is a protected sheet that i am doing this on. do i have to unprotect
first?

"DawnTreader" wrote:

Hello i have a spreadsheet with a button with code attached, i am trying to
remove the button and the code. the code was easy, just copy the sheet. but
the button is not easy. this is my current code for the removal of the button
and stuff:

'create a new workbook to email
Sheets("Weekly Time Record").Select
Sheets("Weekly Time Record").Copy

'remove button and 2nd row in email version
Sheets("Weekly Time Record").Shapes.SelectAll
Selection.Delete
Rows("2:2").Select
Selection.Delete Shift:=xlUp

If Not fs.FolderExists(DirString) Then
fs.CreateFolder DirString
End If
strFName = "Time Card " & SunDT & " " & USRNM & ".xls"
.Parent.SaveAs DirString & "\" & strFName

the line:

Sheets("Weekly Time Record").Shapes.SelectAll
Selection.Delete

keeps crapping out and giving me a out of memory error. i have also tried:

activeworkbook.Shapes.SelectAll
Selection.Delete

this gives me the same problem.

any ideas out there?


--

Dave Peterson