Macro slow opening a file

voodoo

Board Regular
Joined
Apr 7, 2002
Messages
186
I have been asked to try and speed up a very slow macro. One thing I have noticed is that it is very slow to open the input file. The input file is a large excel file - 743KB with about 1400 rows and 54 columns of information in it.

Inside the macro it takes about 25 seconds to open - I have tested this by setting a breakpoint to the open commmand and then timing when it finishes.

The part I dont understand is when I open it normally it takes less than 5 seconds to open. I dont know why it takes over 5 times the time to opne it in a macro.

Perhaps my code to opnw the file could be improved. Any ideas or explanations would be appreciated. Here is the code used in the mcaro to open the file.

Dim wkbDataFile As Workbook
Set wkbDataFile = Application.Workbooks.Open(FileName:=strDataFilename, Format:=2, ReadOnly:=True)

Regards

voodoo
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,213,511
Messages
6,114,054
Members
448,543
Latest member
MartinLarkin

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