Quote Originally Posted by Jan Karel Pieterse View Post
What happens if you change the .Open line to this:
        Dim autom As Long
        autom = Application.AutomationSecurity
        Application.AutomationSecurity = msoAutomationSecurityForceDisable
        Set wb = Workbooks.Open(folderName & "\" & DateiName & ".xlsm")
        Application.AutomationSecurity = autom
I tested it and one out of two files (1st one) which have been created did not close.

Occasionaly it works and all get closed. Most of the times the macro security pops up somewhere after the .Open command (e.g. when pasting to PowerPoint).

What i dont undetstand: Why does it work with the file i provided you but not with my original file, when the code is identical?