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

  • Thread starter Shane Devenshire
  • Start date
S

Shane Devenshire

Hi Folks,

The above message occurs at the point marked in the following code.

Private Sub Workbook_Open()
Dim CurrBookName As String
Dim CurrBook As Workbook
Dim TotEquipNum, CurrEquipNum As Integer

CurrBookName = ActiveWorkbook.Name
Set CurrBook = Workbooks(CurrBookName)

Set DataEntryFormSheet = CurrBook.Worksheets("DataEntryForm") <-- this
line is highlighted when the error occurs.


This application was written in Excel 2003 under XP and is being run on
Excel 2007 under Vista. The user has tested this on a number of machines
and reported the same error. I can't duplicate the problem on my home
machines.

I am not on-site with the user so any feedback you can give would be most
appreciated.

TIA,
Cheers,
Shane Devenshire
 
J

Jacob Skaria

Shane, I am unable to recreate the issue using a new workbook.

--Is the user getting the same error while trying out with a new workbook?

--May be workbook the user has written the code is a bulky one and wouldn't
have completely loaded before a reference could be made. Placing a App wait
before making reference to the sheet could help

If this post helps click Yes
 
S

Shane Devenshire

Thanks Jacob,

I've sent a list of questions to the user, of course it's the weekend and I
don't expect to hear back until Monday at the earliest. I'm having them
check to see what References are attached on their machines, and what SP of
2007 they are running and a few other things. Of course I check the KB but
that was unproductive.

I will have them test your idea. I'm not aware of any errors related to
2007 in this area, but I'm hoping that someone has come across a similar
problem.

I will give you credit for this question later, I don't want other
responders to skip it because its maked as answered.

Cheers,
Shane Devenshire
 
J

Jim Cone

Is there a "DataEntryForm" sheet in the active workbook?
--
Jim Cone
Portland, Oregon USA



"Shane Devenshire"
<[email protected]>
wrote in message
Hi Folks,

The above message occurs at the point marked in the following code.

Private Sub Workbook_Open()
Dim CurrBookName As String
Dim CurrBook As Workbook
Dim TotEquipNum, CurrEquipNum As Integer

CurrBookName = ActiveWorkbook.Name
Set CurrBook = Workbooks(CurrBookName)

Set DataEntryFormSheet = CurrBook.Worksheets("DataEntryForm") <-- this
line is highlighted when the error occurs.


This application was written in Excel 2003 under XP and is being run on
Excel 2007 under Vista. The user has tested this on a number of machines
and reported the same error. I can't duplicate the problem on my home
machines.

I am not on-site with the user so any feedback you can give would be most
appreciated.

TIA,
Cheers,
Shane Devenshire
 
B

Barb Reinhardt

And y ou're sure it has no trailing spaces? I think I'd just do some
checking like this (and I'm sure you know how to do this)

Dim WS as WOrksheet

for each WS in activeworkbook.worksheets
debug.print "'" & ws.name & "'" , ws.name = "DataEntryForm"
next ws
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top