+ Reply to Thread
Results 1 to 4 of 4

Macro loops through files but I am prompted with Continue/Exit Links on each file open

Hybrid View

kyle4570 Macro loops through files but... 08-08-2021, 08:20 AM
BadlySpelledBuoy Re: Macro loops through files... 08-08-2021, 10:01 AM
kyle4570 Re: Macro loops through files... 08-08-2021, 02:23 PM
BadlySpelledBuoy Re: Macro loops through files... 08-08-2021, 02:40 PM
  1. #1
    Forum Contributor
    Join Date
    05-30-2021
    Location
    Colorado Springs
    MS-Off Ver
    Microsoft 365
    Posts
    173

    Macro loops through files but I am prompted with Continue/Exit Links on each file open

    This loops through all files in a folder and applies a macro to them. All of the files have automatic links in them. Whereas I want this to run on several hundred files while I watch TV, I am being bothered by each file open with the "Continue/Edit Links prompt. The links no longer work and no updating needs done, so I want the macro to just assume Continue/Do not attempt to update links.



    Sub Macro1()
         '//Change the path to the main folder, accordingly
        Call RecursiveFolders("C:\Users\Me\Desktop\New folder\")
    End Sub
    
    Sub RecursiveFolders(ByVal MyPath As String)
    
        Dim FileSys As Object
        Dim objFolder As Object
        Dim objSubFolder As Object
        Dim objFile As Object
        Dim wkbOpen As Workbook
        
        Set FileSys = CreateObject("Scripting.FileSystemObject")
        Set objFolder = FileSys.GetFolder(MyPath)
    
        Application.ScreenUpdating = False
        
        For Each objSubFolder In objFolder.SubFolders
            For Each objFile In objSubFolder.Files
                Set wkbOpen = Workbooks.Open(FileName:=objFile)
                 '//Change the name of your macro, accordingly
                Call Create_Import_Data
                wkbOpen.Close savechanges:=True
            Next
            Call RecursiveFolders(objSubFolder.Path)
        Next
    
        Application.ScreenUpdating = True
        
    End Sub

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    8,057

    Re: Macro loops through files but I am prompted with Continue/Exit Links on each file open

    Have you tried setting "Display Alerts" to False?

    So where you have
    Application.ScreenUpdating = False
    You could use
    With Application
        .ScreenUpdating = False
        .DisplayAlerts = False
    End With
    Set it back to True again at the end of your code.

    BSB

  3. #3
    Forum Contributor
    Join Date
    05-30-2021
    Location
    Colorado Springs
    MS-Off Ver
    Microsoft 365
    Posts
    173

    Re: Macro loops through files but I am prompted with Continue/Exit Links on each file open

    Quote Originally Posted by BadlySpelledBuoy View Post
    Have you tried setting "Display Alerts" to False?

    So where you have
    Application.ScreenUpdating = False
    You could use
    With Application
        .ScreenUpdating = False
        .DisplayAlerts = False
    End With
    Set it back to True again at the end of your code.

    BSB

    Good. Works. Thanks!

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    8,057

    Re: Macro loops through files but I am prompted with Continue/Exit Links on each file open

    Glad I could help

    BSB

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 03-10-2020, 11:34 AM
  2. [SOLVED] Problem with a relative file path in macro that loops through files in folder
    By happyfingers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2017, 02:53 AM
  3. Exit macro when no file is selected for open
    By fblaze in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2014, 04:08 PM
  4. [SOLVED] Message box if Yes continue with subroutine and if NO then exit sub and open sheet2
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-19-2014, 05:59 PM
  5. Macro to select "Continue" when opening another file and prompted to update links
    By kwaldersen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-25-2012, 11:57 AM
  6. VBA for excel 2003. Open file dialog box, open 2007 file xlsx, continue with code
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2011, 12:12 AM
  7. not being prompted that user has file open
    By maryj in forum Excel General
    Replies: 0
    Last Post: 12-15-2005, 11:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1