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

When using my userform, I want it to delete a page from the book in th
end. I have the code for deleting it, but it pops up that dialogue bo
asking me to delete it again. How do I write into the macro to confir
the deletion?

Private Sub CommandButton1_Click()
MsgBox "Your Submission is being recorded and printed"
MsgBox "Please make sure you place a copy in the Representativ
Perfect Folder"
Dim ctrl As Control
Dim chkbx As MSForms.CheckBox
For Each ctrl In Me.Controls
If TypeOf ctrl Is MSForms.CheckBox Then
Set chkbx = ctrl
If chkbx Then
Worksheets(chkbx.Caption).PrintOut
End If
End If
Next
SHEETS(\"T2S\").SELECT
ACTIVEWINDOW.SELECTEDSHEETS.DELETE

newFolder$ = "C:\Documents and Settings\Administrator\Desktop\"
TextBox1.Text
MkDir newFolder$
NewFile$ = newFolder$ & "\" & TextBox2.Text & ".xls"
ThisWorkbook.SaveAs NewFile$
Unload Me
End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default userform delete sheet

application.DisplayAlerts = False
SHEETS(\"T2S\").SELECT
ACTIVEWINDOW.SELECTEDSHEETS.DELETE
Application.DisplayAlerts = True

--
Regards,
Tom Ogilvy

"dok112 " wrote in message
...
When using my userform, I want it to delete a page from the book in the
end. I have the code for deleting it, but it pops up that dialogue box
asking me to delete it again. How do I write into the macro to confirm
the deletion?

Private Sub CommandButton1_Click()
MsgBox "Your Submission is being recorded and printed"
MsgBox "Please make sure you place a copy in the Representative
Perfect Folder"
Dim ctrl As Control
Dim chkbx As MSForms.CheckBox
For Each ctrl In Me.Controls
If TypeOf ctrl Is MSForms.CheckBox Then
Set chkbx = ctrl
If chkbx Then
Worksheets(chkbx.Caption).PrintOut
End If
End If
Next
SHEETS(\"T2S\").SELECT
ACTIVEWINDOW.SELECTEDSHEETS.DELETE

newFolder$ = "C:\Documents and Settings\Administrator\Desktop\" &
TextBox1.Text
MkDir newFolder$
NewFile$ = newFolder$ & "\" & TextBox2.Text & ".xls"
ThisWorkbook.SaveAs NewFile$
Unload Me
End Sub


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default userform delete sheet

Ok, can I use the same concept to delete a sheet if it is unchecked.
Basically, the form is going to print out all the sheets that ar
checked, and I need it to delete the unchecked sheets before it save
the file to one of my drives.

Dim ctrl As Control
Dim chkbx As MSForms.CheckBox
For Each ctrl In Me.Controls
If TypeOf ctrl Is MSForms.CheckBox Then
Set chkbx = ctrl
If chkbx Then
Worksheets(chkbx.Caption).PrintOut
End If
End If
Nex

--
Message posted from http://www.ExcelForum.com

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
Centering A Userform On The Sheet John Calder New Users to Excel 3 July 30th 09 12:38 AM
userform freezes sheet teepee[_3_] Excel Discussion (Misc queries) 2 October 26th 08 04:12 PM
UserForm and combo box to another sheet Nigel Excel Discussion (Misc queries) 0 April 29th 05 09:41 AM
Selecting sheet after Userform Denny Behnfeldt Excel Programming 5 February 18th 04 03:41 AM
Delete userform/module using VB Rohit Thomas Excel Programming 5 July 16th 03 11:01 PM


All times are GMT +1. The time now is 02:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"