Results 1 to 3 of 3

Access VBA To Overwrite File

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

    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 online now Expert
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    987
    Application.DisplayAlerts = False

    Usually works with me.


    Sent from my iPhone using Tapatalk
    Andy to all.
    (Is your topic sorted? Please mark your thread as solved)

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    557
    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, 06:47 AM
  2. Replies: 4
    Last Post: 11-26-2014, 11:25 AM
  3. Replies: 2
    Last Post: 05-01-2014, 12:31 PM
  4. Access Import from Excel Overwrite
    By redpanda in forum Programming
    Replies: 8
    Last Post: 07-10-2011, 08:18 PM
  5. XML File Import To Access...Overwrite Issue
    By wipers123 in forum Import/Export Data
    Replies: 0
    Last Post: 02-11-2010, 11:27 AM

Posting Permissions

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