Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / October 2007

Tip: Looking for answers? Try searching our database.

Run time error "57121"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CAM - 23 Sep 2007 05:48 GMT
Hello,

I get this error everytime I press a command button "Run Time Error 57121"
Application-defined or object-define error.

What I did was copied a worksheet into a new  workbook and adjust the
worksheet in my coding below.  Why do I get this and How do I make my
program work?  Any tip or website to visit will be appreciate.  Thank you in
advance,

Private Sub cmdClear_Click()

'Message box
   Dim Msg, Style, Title, Help, Ctxt, Response, MyString
   Msg = "You are about to erase inputted cells.  Press OK to proceed or No
to cancel."
   Style = vbOKCancel + vbCritical + vbDefaultButton2
   Title = "Erase Cells?"
   Response = MsgBox(Msg, Style, Title, Help, Ctxt)
   If Response = vbOK Then                               .
           MyString = "OK"

'Temporary unprotect worksheet
           Worksheets("dept").Unprotect ("res")

'Error routine
On Error Resume Next

'Select sheet, cell range and clear inputted cells.
           Worksheets("dept").Range("C13:F13").ClearContents

'Protect worksheet and allow column, row, and cell format
           Worksheets("dept").Protect ("res"), DrawingObjects:=True,
Contents:=True, Scenarios:=True _
           , AllowFormattingCells:=True, AllowFormattingColumns:=True, _
           AllowFormattingRows:=True

'Notify user inputted cells has been cleared
           MsgBox "Erase!", vbInformation + vbOKOnly, "erase Inputted
Cells"

'Error routine
On Error GoTo 0

   Else
   MyString = "Cancel"                                    ' End program.

End If

End Sub
Wild Bill - 01 Oct 2007 10:05 GMT
Activate the proper workbook first.

Due credit to keepITcool
http://groups.google.com/group/microsoft.public.excel.programming/browse_thread/
thread/90674469c24adaa2?hl=en


>I get this error everytime I press a command button "Run Time Error 57121"
>Application-defined or object-define error.
[quoted text clipped - 44 lines]
>
>End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.