Results 1 to 6 of 6
  1. #1
    zdassu is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    3

    Cut and Paste using VBA in ACCESS 2007

    Hi I am new to VBA and I am looking for some code to use in access 2007 where I can cut the entire contents of a folder on my C: drive and paste it in a separate folder in my C: Drive

    Thankyou.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If your OS is located on your C drive, you will not be able to "Cut" the entire C drive. You probably will not be able to "Copy" the entire C drive either. Are you trying to Clone?

    Maybe this is what you are looking for?
    https://www.accessforums.net/program...ugh-39179.html

  3. #3
    zdassu is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    3
    Thank you for your help at the end I used the following code which done the trick, it actually cops pastes and deletes the file in the source

    Code:
    Dim sourceFile As String, destinationFile As String
    Dim aFSO As Object
    sourceFile = "C:\Users\Test1\ToImport"
    destinationFile = "C:\Users\Test1\imported"
    Set aFSO = CreateObject("Scripting.FileSystemObject")
    aFSO.CopyFolder sourceFile, destinationFile
    Kill "C:\Users\Test1\ToImport\*.URS*"

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Glad you have it sorted out and welcome to the forum. In the future, please be sure to tell other users if you are cross posting your question in other forums and provide a link to your other thread. Thank you.

  5. #5
    zdassu is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    3
    Thanks but I actually got it from a colleague in my organisation through another colleague

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Great. Thank you for sharing your solution. This may benefit others that need an answer for their project. Once again, welcome!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Copy Paste the entire MS Access Database
    By mkc80 in forum Access
    Replies: 6
    Last Post: 08-24-2012, 01:07 PM
  2. Copy paste from CSV to Access 2010
    By mschmucker in forum Access
    Replies: 1
    Last Post: 12-16-2011, 04:33 PM
  3. Replies: 2
    Last Post: 06-18-2011, 09:55 AM
  4. Access copy/paste error in Shared mode
    By somm in forum Access
    Replies: 6
    Last Post: 12-16-2010, 08:59 AM
  5. Paste Data From Excel To Access Form
    By fanzak in forum Programming
    Replies: 2
    Last Post: 08-16-2010, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums