+ Reply to Thread
Results 1 to 7 of 7

Bypass "File has Macros" warning when opening a series of excel files to extract data?

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Bypass "File has Macros" warning when opening a series of excel files to extract data?

    I have a working Excel macro that combines data from several other files that all have the same layout. My annoyance is that it prompts me for each file being opened saying that it contains macros, etc and do I want to continue.

    Is there a way to bypass this so the entire process is more streamlined?
    If this has been helpful, please click on the star at the left.

  2. #2
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Bypass "File has Macros" warning when opening a series of excel files to extract data?

    Additional info: The OPEN file statements are shown below in bold. Is there an option to ignore the 'File Contains Macros' message?

    Here is the macro code to open the files….
     Sub Process_one_File(folderPathname As String, registrationFileName As String)
    
      Dim sheetName As String
      Dim ok As Integer
      Dim lastRow1 As Long
      Dim lastRow2 As Long
      Dim sourceDataRange As Range
      Dim MasterDataRange As Range
      Dim itemRange As Range
      Dim itemCell As Range
      Dim clubAbbrev As String
      Dim r As Long
      
     
      ok = 1
      If registrationFileName = ThisWorkbook.Name Then ok = 0   ' skip this file
      If Left$(registrationFileName, 11) = "GSL-Entries" Then ok = 0   'skip backup copies of this file
      If ok = 0 Then Exit Sub
    
      'MsgBox registrationFileName
      
      ' ...  Begin by opeing the selected file, etc   (MAC version)
      If Application.OperatingSystem Like "*Mac*" Then
        Workbooks.Open filename:=folderPathname & ":" & registrationFileName, ReadOnly:=True
      Else
        Workbooks.Open filename:=folderPathname & "\" & registrationFileName, ReadOnly:=True
      End If
    
      '  ……  process the file…

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,283

    Re: Bypass "File has Macros" warning when opening a series of excel files to extract data?

    Try putting

    Application.DisplayAlerts = False
    before opening the file.

    Don't forget to switch it back to True after processing the file.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Bypass "File has Macros" warning when opening a series of excel files to extract data?

    Thanks bakerman2 for the tip. I had forgotten about that.

    Unfortunately, it did not do the trick when I grid it. :-(

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,283

    Re: Bypass "File has Macros" warning when opening a series of excel files to extract data?

    I had my doubts it would work since this is a Security feature against malicious software.

    One other option is to add the location of the files to the Trusted Locations in Excel Options.

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Bypass "File has Macros" warning when opening a series of excel files to extract data?

    as bakerman pointed out
    its a security feature which you need to bypass

    some step by step
    http://blog.contextures.com/archives...urity-warning/

    comments at end gives other suggests other things you may want to try
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Bypass "File has Macros" warning when opening a series of excel files to extract data?

    Hi

    I suggest
    application.automationsecurity = msoautomationsecuritylow
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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. [SOLVED] Excel 2010 -- "Visual Basic" "Macros" and "Record Macro" all disabled.
    By NicholasL in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2017, 06:11 AM
  2. Get / Extract data from another "CLOSED" excel file
    By ahmedomara in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2013, 09:26 AM
  3. Opening 4 excel files, copying set table data and pasting into "master file".
    By Belloni in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-29-2012, 09:50 AM
  4. "File in use" prompt when opening files
    By VBA FTW in forum Excel General
    Replies: 0
    Last Post: 08-16-2012, 07:11 PM
  5. Replies: 2
    Last Post: 03-06-2006, 10:40 AM
  6. [SOLVED] Bypass the "Macros may contain viruses . . ." message
    By Al in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-21-2005, 03:05 PM
  7. Replies: 2
    Last Post: 10-15-2005, 10:05 AM
  8. Replies: 1
    Last Post: 07-04-2005, 02:05 PM

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