+ Reply to Thread
Results 1 to 3 of 3

Replacing one file with another without display alerts

Hybrid View

  1. #1
    Valued Forum Contributor SDruley's Avatar
    Join Date
    04-27-2009
    Location
    Conover, NC
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    415

    Angry Replacing one file with another without display alerts

    I have two files A and B. I want to do a save as with B onto A. The problem is that I get this message that the file exists. The message says, A) replace A with B? B) save both C) do nothing. How can I default to the replace A with B without the popup message?
    using:
    Application.DisplayAlerts =False
    has no affect.
    Last edited by SDruley; 08-12-2010 at 11:27 AM. Reason: Added two lines of code and fix the problem

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Replacing one file with another without display alerts

    That should work fine - can you show us a bit more of your code?

  3. #3
    Valued Forum Contributor SDruley's Avatar
    Join Date
    04-27-2009
    Location
    Conover, NC
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    415

    Smile Re: Replacing one file with another without display alerts

    ' The purpose of this code is to locate and unzip a file then save the
    ' newly created, unzipped file over top of a file with the same name.
    Sub UNZIPandSAVEAS()
        Dim FSO As Object
        Dim oApp As Object
        Dim Fname As Variant
        Dim NewFile As Variant
        Dim DefPath As String
        Dim strDate As String
        Fname = "C:\Users\Steve\ftp\DOWBUFF.zip"
            'Root folder for unzipped file
            DefPath = "C:\Users\Steve\ftp\UnzippedBUFFS\"
            NewFile = DefPath ' Variant
            'Extract the file into the newly created location
            Set oApp = CreateObject("Shell.Application")
            ' Copy the newly unzipped file to the new location (Save - As)
            oApp.Namespace(NewFile).CopyHere oApp.Namespace(Fname).items
            ' Close temporary file
            On Error Resume Next
            Set FSO = CreateObject("scripting.filesystemobject")
            FSO.deletefolder Environ("Temp") & "\Temporary Directory*", True
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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