Results 1 to 3 of 3
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    666

    Access VBA To Overwrite File

    I am using Access VBA to Instantiate Excel and write data to Excel. Procedure writes data perfect. The one issue that I have is that I want the Access VBA to, if Excel file already exists, to over-write the file with no prompt. I have tried this syntax, but it still asks for confirmation before over-writing. What do I change to over-write the file?
    Code:
    Public Sub Test()
    Dim wb As Object, saveloc As String
    
    
    	'Setting Save location
    	saveloc = "C:\Excel\Testing\Testworkbook.xlsx"
    	
        'Saving the workbook
        wb.SaveAs filename:=saveloc
        
        'Closing the workbook
        wb.Close
    	
    End Sub


  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Application.DisplayAlerts = False

    Usually works with me.


    Sent from my iPhone using Tapatalk

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    666
    Quote Originally Posted by andy49 View Post
    Application.DisplayAlerts = False

    Usually works with me.


    Sent from my iPhone using Tapatalk
    That threw an error, I ended up having to use
    Code:
     DoCmd.SetWarnings True

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

Similar Threads

  1. Replies: 2
    Last Post: 05-26-2016, 07:47 AM
  2. Replies: 4
    Last Post: 11-26-2014, 12:25 PM
  3. Replies: 2
    Last Post: 05-01-2014, 01:31 PM
  4. Access Import from Excel Overwrite
    By redpanda in forum Programming
    Replies: 8
    Last Post: 07-10-2011, 09:18 PM
  5. XML File Import To Access...Overwrite Issue
    By wipers123 in forum Import/Export Data
    Replies: 0
    Last Post: 02-11-2010, 12:27 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