Run-time error 57121 "Application-defined or object-defined error"

Spoony

New Member
Joined
Jun 12, 2009
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Hi

I have the following code that just puts some information into a couple of cells. This works fine and the company is using it.

However, I am now working on a version 2 to which I have added a few more cells and another worksheet just to make it a little easier to use. Now when I open the file I get the following error: Run-time error 57121 "Application-defined or object-defined error". As nothing has really changed and the old one still works (I copied the code) I'm stumped as to what the issue is.


Private Sub Workbook_Open()

ActiveSheet.Unprotect

If Worksheets("M+M Sheet").Cells(2, 11).Value = "" Then
Worksheets("M+M Sheet").Cells(2, 11).Value = Date
End If

If Worksheets("M+M Sheet").Cells(12, 5).Value = "" Then
Worksheets("M+M Sheet").Cells(12, 5).Value = UCase(Environ("USERNAME"))
End If

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

End Sub


Any advice would be appreciated.

Thanks

Steve
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi Steve,

Is there a line inidated in debug mode where the error occurred?
If you can not debug the code easily, place all code in en new sub and call that sub from Workbook_Open.
This allows you to run the code manually and debug it.
 
Upvote 0
Hi Steve,

Is there a line inidated in debug mode where the error occurred?
If you can not debug the code easily, place all code in en new sub and call that sub from Workbook_Open.
This allows you to run the code manually and debug it.

Yes, it's the unprotect line.

I have saved the previous version to a new file and made all my changes again and it now seems to work.
 
Upvote 0
I have the same error, but what is a "inidated" line, or that matter the "unprotect line". My spreadsheet has columns J through XFD hidden. Once I unhide everything it works OK. However, I know the customer will want to have the sheet shown as I received it with the hidden columns
 
Upvote 0
The 'unprotected line' is:

Code:
ActiveSheet.Unprotect

The 'inidated line' is, I guess, the line of code that's highlighted when the error occurs and you press debug.
 
Upvote 0
This runtime error of MS Excel could be using ways mentioned beneath.
1. Disable proxy
Open the Command Prompt, in order to check, if you are behind the proxy. For this, you have to press the Windows key + R, both at the same time and then type CMD, and press OK.
A command prompt windows would be opened, then type the following command netsh winhttp import proxy source=ie and then press enter. If you are still getting “Error writing proxy settings (5) Access is denied.” In that case, error code 57121 could be fixed, if proxy settings in internet explorer should be disabled.
2. Improper installation
If MS Office is uninstalled or during update if any DLL file goes missing error may occur. In that case, you would get runtime error 57121. Thus fixing the missing DLL could help you with this runtime error, you have to press Windows key and R at the same time and type regsvr32 dllfix.dll and then hit OK.
For trouble free and fast solution you can make use of MS Excel Repair Tool that’s highly professional software to fix any Excel error. It can also repair corrupt excel file, excel worksheet, excel workbook and so on. Moreover, it has a simple user interface.
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,142
Members
448,551
Latest member
Sienna de Souza

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top