VBA opening files with slower connection

NickvdB

Board Regular
Joined
Apr 30, 2014
Messages
71
Hello,

At my work we have 20 team members who update a personal file on a daily basis. This is consolidated in 1 file which is copied to a dashboard file (all done by VBA). Since I noticed updating of links to other files works faster when these seperate personal files are opened, the VBA is designed to first open all these files and then the file with all the links. When running the VBA, especially on a slower internet connection, the VBA is willing to work faster then the opening of files is done. Even when I have given the ScreenUpdating=False command I still get a dialog with status of opening files and also on certain occassions the screen gets messed up during the execution. VBA still continues, but I'm guessing not efficient and also not in a smooth visual way.
Since this VBA is written to reduce time I rather not build a WAIT of one second per file opening.

Does anybody has a solution???

Code is as following:
Dim MyFolder As String
Dim MyFile As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False

MyFolder = "F:\"
MyFile = Dir(MyFolder & "\*.xlsx")
Do While MyFile <> ""
Workbooks.Open Filename:=MyFolder & "\" & MyFile, UpdateLinks:=False
MyFile = Dir
Especially here screenupdating sort of turns on caused by slower opening of files
Loop
Workbooks.Open "F:\temp.<wbr>xlsb", UpdateLinks:=True
Especially here screenupdating sort of turns on caused by slower opening of files
Workbooks("tempa.xlsm").Worksheets("<wbr>Timewriting").Range("a4:<wbr>ajz1500").Value = Workbooks("<wbr>temp.<wbr>xlsb").Worksheets("<wbr>Timewriting").Range("a4:<wbr>ajz1500").Value

For Each wb In Application.Workbooks
If wb.Name <> ThisWorkbook.Name Then
wb.Close SaveChanges:=False
End If
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Do you have any Workbook_Open events in other files that are affecting the ScreenUpdating? I have a few files at work that run a few procedures on open turning ScreenUpdating On and Off. This negates the previous code and unintentionally makes the opening and closing of the file visible....

You might try writing in something like this with your loop but with a counter on it that counts what file is being processed out of the total:

Code:
Application.StatusBar = "Please be patient..."</pre>

It may help to better identify what file/files are causing the issues....

Take a look at this link : DataPig Technologies Status Bar


Also....sometimes processing takes some time.
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,941
Members
449,094
Latest member
teemeren

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