Run time error 57121

ashlad

Board Regular
Joined
Aug 22, 2002
Messages
56
Can someone help. I amgetting the error on opening a worksheet with some very simple VBA. In a previous post it was suggested this error can be solved by putting a delay when into excel between excel starting and the vba kicking in. Does anyone know how to do this?

Thanks in advance.

ASHLAD
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
It would probably help if you linked to the previous post, or better yet, if this is a continuation of the same problem, don't start a new thread.

As is, its hard to tell what you're talking about.

:LOL:

I should add that putting a "delay" between when you open the workbook and when the VBA starts, is kind of contradictory, you would need to employ VBA to accomplish such a delay, as far as I know.
 
Upvote 0
Ah jeez!

A Mr Excel/Mark O'Brien post, I might get myself in trouble.

Apperantly, MrExcel was having a problem because the spreadhsheet wasn't completely loaded before a VBA reference to a sheet was made, thus bugging up the reference. Keep in mind, that VBA was already running at this point.

Code as follows:
Code:
If Application.Wait(Now + TimeValue("0:00:10")) Then
    MsgBox "Time expired"
End If
will pause your code.

You don't need the If, but wait returns the boolean value True once the end time is reached, so that's where you'd put your code that need to fire once the wait time is expired.

To my knowledge, there is no way to cause Excel to pause before beginning the execution of VBA code, since as I said, this would require code to accomplish.

HTH,
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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