OK, Amit, create your excel with from row 2 the files, from-paths and
to-paths as specified... If you save that workbook as "c:\xls
\MoveIt.xls" then the following "MoveIt.vbs" will do what you
expect... just run it under windows...

Let me know if you are satisfied...

Greetings

Paul Willekens
'=======================================================================
Option Explicit

Dim cFile
Dim cFrom
Dim cTo

Dim lDone

Dim nRow

Dim oFSO
Dim oWBook
Dim oXL

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oXL = WScript.CreateObject("Excel.Application")
oXL.Visible = False
Set oWBook = oXL.WorkBooks.Open("c:\xls\MoveIt.xls")

lDone = False
nRow = 2

While Not lDone
  cFile = oXL.Cells(nRow, 1).Value
  If Len(cFile) < 1 Then
    lDone = True
  Else
    cFrom = oXL.Cells(nRow, 2).Value
    cTo = oXL.Cells(nRow, 3).Value
    If oFSO.FileExists(cFrom & "\" & cFile) Then
      oFSO.MoveFile (cFrom & "\" & cFile), (cTo & "\" & cFile)
    Else
      MsgBox (cFrom & "\" & cFile) & " not found !"
    End If
    nRow = nRow + 1
  End If
Wend

oWBook.close(False)
oXL.WorkBooks.Close
oXL.Quit

WScript.Quit
'*************************  end of script
*****************************

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our Facebook Group @ http://www.facebook.com/group.php?gid=287779555678
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

To unsubscribe from this group, send email to 
excel-macros+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to