Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MOVE FILE

Posted on 2016-10-31
2
Medium Priority
?
66 Views
Last Modified: 2016-11-01
I would like to move a file from one location to another,overwrite the file if it's exists in the new location and inform the user if the transfer was successful.
Thanks
0
Comment
Question by:Svgmassive
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 88

Expert Comment

by:rindi
ID: 41867425
What OS? and what does this have to do with m$ Access?
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 41867487
try ths codes


Sub MoveFile()
Dim sFile As String, sPath As String, sDest As String
sPath = "C:\Users\xxx\OldFolder\"
sFile = "myExcel.xlsx"
sDest = "C:\Users\xxx\NewFolder\"
If Dir(sDest & sFile) <> "" Then
    Kill sDest & sFile
End If
   
Name sPath & sFile As sDest & sFile

If Dir(sDest & sFile) <> "" Then
    MsgBox "File moved"
End If

End Sub
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question