Optimering af VBA til åbning af filer
HejJeg har følgende sub til åbning, opdatering og lukning af 40 filer:
Dim xlsHome, c As Range
Sub HentDataX()
'Slå skærm og msg fra
Application.DisplayAlerts = False
Application.ScreenUpdating = False
'Efterregn workbook
xlsHome = ActiveWorkbook.Name
Workbooks(xlsHome).Application.Calculate
'Hent sti og filtype
Sti = Range("Sti")
Filtype = Range("Filtype")
'Åben xls-filer
For Each c In Range("Filnavne").Cells
If c.Value <> Empty Then Workbooks.Open Filename:=Sti + c.Value + "." + Filtype, ReadOnly:=True, IgnoreReadOnlyRecommended:=True
Next c
'Efterregn xlsHome-workbook og sæt til manuelberegning
Workbooks(xlsHome).Application.Calculate
Workbooks(xlsHome).Application.Calculation = xlCalculationManual
'Aktiver xlsHome-workbook
Workbooks(xlsHome).Activate
'Luk filer
For Each c In Range("Filnavne").Cells
If c.Value <> Empty Then Workbooks(c.Value + "." + Filtype).Close SaveChanges:=False
Next c
'Slå opdatering af skærm og msg til
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Mit problem er, at det kører meget langsomt, og jeg får en message box op, hvori der står "opening....stinavn+filnavn".
Ligeledes kan jeg se de 40 filer blive åbnet i taskbar'en.
Er der en løsning på ikke at få vist filerne i taskbar'en, der åbnes og messageboxen?
