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
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