Results 1 to 10 of 27

Thread: VBA Dir File Copy and Paste: Check if file exists then copy file from one directory to another. Bat File

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0

    Macro Correction(If condition met then do something & if not then do nothing)



    “Moderator” Notice
    September 2020
    Given up with this “OP” , Avinash around September 2020. https://excelfox.com/forum/showthrea...ll=1#post14972
    https://excelfox.com/forum/showthrea...ll=1#post14972

    I am no longer monitoring what its doings. It had curiosity appeal for a while, but even that has worn off me now!
    It’s getting worse by the Day. Its still doing whatever it is that it is doing and getting Replies and answers at excelforum.com and likely a few places I don’t know about.








    Hi Experts,

    Code:
    Option Explicit
    
    Sub STEP2()
    Dim wkb As Workbook
    Set wkb = Workbooks.Add
    wkb.SaveAs Filename:="C:\Users\WolfieeeStyle\Desktop\FALSEFALSEFALSE.xlsx"
    wkb.Close
    Dim fso As Object
    Dim strFileName As String
    Dim strFileExists As String
    Set fso = CreateObject("scripting.filesystemobject")
     
        strFileName = "C:\Users\WolfieeeStyle\Desktop\FALSEFALSEFALSE.xlsx"
        strFileExists = Dir(strFileName)
     
       If strFileExists > "" Then
       fso.movefile Source:="C:\Users\WolfieeeStyle\Desktop\FALSEFALSEFALSE.xlsx", _
                    Destination:="C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\FALSEFALSEFALSE.xlsx"
         Shell "taskkill /F /IM EXCEL.EXE"
        Else
            
        End If
        
    End Sub
    This macro does what i want & I need a confirmation that this macro is perfect & it has no errors & if there is anything which needs to be modified then plz modify the same & let me know


    Thnx




    Cross Post

    https://eileenslounge.com/viewtopic....273280#p273280
    Last edited by DocAElstein; 09-26-2020 at 07:04 PM. Reason: cross post

Similar Threads

  1. Replies: 85
    Last Post: 06-09-2020, 05:58 PM
  2. Replies: 4
    Last Post: 05-08-2014, 10:12 PM
  3. Replies: 7
    Last Post: 08-28-2013, 12:57 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •