Results 1 to 3 of 3
  1. #1
    RogerD is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Location
    Ky
    Posts
    27

    Turn Off Warnings to Overwrite "ExportWithFormatting"

    I have a macro in Access that exports 4 tables to xlsx spreadsheets. I use "SetWarnings No" to turn off all warnings when running queries, etc...
    but this does not work to turn off "Do you want to replace the existing file?" when tables are output to excel to replace existing tables.



    I am writing out 4 tables to Excel spreadsheets, and that requires saying "Yes", 4 times.

    How can I turn this off to save time?

  2. #2
    RAshA.pro777 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2015
    Posts
    41
    If you use set warning in the first line it will work and hide all warnings ,
    And you should to enable all macro in trust center or add the partition which include your work in the trusted locations

  3. #3
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    the warning you are getting is not an access warning but a windows explorer one so setwarnings won't work

    what you need to do is modify your code to check for the existence of the file and delete it if it exists

    you can just try to delete the file whether it exists or not - if it doesn't exist a vba error will be generated which can be 'ignored' by putting 'on error resume next' just before the delete line and 'on error goto 0' just after - or better to handle within an error handler

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  2. Replies: 4
    Last Post: 05-16-2014, 12:32 PM
  3. turn "about to delete record" warning back on
    By markjkubicki in forum Programming
    Replies: 1
    Last Post: 11-01-2012, 12:21 PM
  4. Turn OFF Warnings in Access 2010
    By taimysho0 in forum Programming
    Replies: 3
    Last Post: 01-27-2012, 05:47 PM
  5. Turn warnings off
    By Mclaren in forum Programming
    Replies: 6
    Last Post: 05-03-2010, 12:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums