Hello everyone,

I'd like to pose a VBA question.

I have a file ("MENU TOTAL.xlsm") that has a macro to open other Excel files, retrieve data from them storing it in a variable, and then close the workbooks without saving.

The thing is, the opened Excel files have macros that run automatically and have, within the code, the Application.Screenupdating = False/True command.

Everytime I run the macro in "MENU TOTAL.xlsm", I'd like NOT TO see the other workbooks opening and closing. So I used the Aplication.Screenupdating = False/True in this macro too.

The thing is: this isn't working. When a file is opened, I can still see it.

I guess this happens because the opened file has a macro (that also triggers the Screenupdating off and on...) that runs automatically when it is opened.

Is there any way to solve this? Is there an alternative command to Screenupdating, or a way to stop auto-run macros from running?

This is my code in the file "MENU TOTAL.xlsm". I hope someone can shed some light on this subject...

Thanks a lot!

' HERE IS MY CODE:

Sub obras_angola()

Application.ScreenUpdating = False

Folha15.Range("A200:A220") = ClearContents

Dim pasta As String, ficheiros As String
Dim file_count As Integer
Dim contador_de_linhas As Integer, num_ficheiros_do_pais As Integer, i As Integer
Dim nomesficheiros(30) As String
Dim nomefolha As String
Dim nome_de_cada_obra As String

pasta = ThisWorkbook.Path & "\"
ficheiros = Dir(pasta & "Crono AO*.xlsm", vbNormal)

i = 1
Do While ficheiros <> ""
nomesficheiros(i) = (pasta & ficheiros)
file_count = file_count + 1
i = i + 1
ficheiros = Dir
Loop

For num_ficheiros_do_pais = 1 To file_count
Workbooks.Open Filename:=nomesficheiros(num_ficheiros_do_pais)
ActiveWorkbook.Worksheets(1).Activate
nome_de_cada_obra = Range("F6").Value
ActiveWorkbook.Close savechanges:=False
ThisWorkbook.Activate
Folha15.Cells(num_ficheiros_do_pais + 199, 1) = nome_de_cada_obra
Next num_ficheiros_do_pais

Folha15.Cells(200, 1).Value = "TOTAL DE ANGOLA"

Application.ScreenUpdating = True

UserForm1.Show

End Sub