Workbook_Open VBA

pujo

Well-known Member
Joined
Feb 19, 2009
Messages
708
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
I have a WorkBook on a network drive.
The network is EXTREMELY SLOW, When I open the workbook, the Workbook_Open event is triggered.
Being that the network is slow, the code is executing before the workbook is completely opened thus causing errors.

Is there a way I can delay the Workbook_Open code until the workbook is fully opened, and ready?

I've tried this, but doesn't work. Seems it is always "Ready"
VBA Code:
If Not Application.Ready = True Then

Appreciate the assistance!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try to set a timer.

VBA Code:
Private Sub Workbook_Open()
    Const delayInterval As Integer = 1000 ' Adjust as needed
    Application.OnTime Now + TimeValue("00:00:01"), "YourNormalSubGoesHere"
End Sub
 
Upvote 0
Solution
Getting an overflow error on "Const delayInterval As Integer"
 
Upvote 0
Getting an overflow error on "Const delayInterval As Integer"
The value you've assigned to delayInterval is probably too large for the Integer data type. Change to Long.
 
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,654
Members
449,113
Latest member
Hochanz

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