+ Reply to Thread
Results 1 to 3 of 3

Macro Correction(If File Exist then Move, Else do nothing)

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-16-2009
    Location
    NA
    MS-Off Ver
    MS Excel 2010
    Posts
    237

    Macro Correction(If File Exist then Move, Else do nothing)

    Sub STEP6()
        Set fso = CreateObject("scripting.filesystemobject")
        fso.MoveFile Source:="C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\Close Excel.lnk", Destination:="C:\Users\WolfieeeStyle\Desktop\"
        fso.MoveFile Source:="C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\STEP7.xlsb", Destination:="C:\Users\WolfieeeStyle\Desktop\"
    End Sub

    This is the macro,I need to update this macro
    If these files are located then move the files & if not then do nothing


    Thnx

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,312

    Re: Macro Correction(If File Exist then Move, Else do nothing)

    Possibly...
    Sub STEP6()
        Dim fso As Object
        Set fso = CreateObject("scripting.filesystemobject")
        If fso.fileexists("C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\Close Excel.lnk") Then
            fso.MoveFile Source:="C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\Close Excel.lnk", Destination:="C:\Users\WolfieeeStyle\Desktop\"
        End If
        If fso.fileexists("C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\STEP7.xlsb") Then
            fso.MoveFile Source:="C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\STEP7.xlsb", Destination:="C:\Users\WolfieeeStyle\Desktop\"
        End If
    End Sub

  3. #3
    Forum Contributor
    Join Date
    07-16-2009
    Location
    NA
    MS-Off Ver
    MS Excel 2010
    Posts
    237

    Re: Macro Correction(If File Exist then Move, Else do nothing)

    Thnx Alot Dangelor Sir for helping me in solving this problem Sir
    Problem Solved
    Have a Awesome Day

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Export to .pdf macro - check if the name of file already exist
    By flop123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2020, 11:23 AM
  2. [SOLVED] Macro that runs when a sheetname in a file does not exist
    By Jstns in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2019, 04:37 PM
  3. [SOLVED] if file exist macro problem
    By etuzgen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2014, 06:41 AM
  4. [SOLVED] Save as macro; File allready exist
    By tigergutt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-02-2013, 09:15 AM
  5. Have macro over write existing file from control button if file exist
    By pjbassdc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2011, 10:35 AM
  6. Replies: 3
    Last Post: 03-11-2006, 02:50 PM
  7. Replies: 0
    Last Post: 03-10-2006, 05:55 AM

Tags for this Thread

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