+ Reply to Thread
Results 1 to 5 of 5

Helped! Tried to copy folder into another folder but failed

  1. #1
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Exclamation Helped! Tried to copy folder into another folder but failed

    Hi Guys,

    Im quite new to VBA and im having problem copying folders.

    Option Explicit

    Sub autoCopy()


    Dim PathName As String
    Dim FSO As Object
    Dim FromPath As String
    Dim ToPath As String


    PathName = ActiveCell.Value
    MsgBox PathName '>> this is my pathname (Y:\2. USERS\Asri\MACC New Name\2010-08-12\HD001Y0\)

    ' FileCopy PathName, "Y:\2. USERS\Asri\testing\"


    FromPath = PathName '<< Change
    MsgBox PathName

    ToPath = "Y:\2. USERS\Asri\testing" '<< Change


    End Sub

    Appreciate your help guys

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Helped! Tried to copy folder into another folder but failed

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Helped! Tried to copy folder into another folder but failed

    Sub folderCopy()
    Dim PathName As String
    Dim FSO As Object
    Dim FromPath As String
    Dim ToPath As String
    PathName = ActiveCell.Value
    MsgBox PathName '>> this is my pathname (Y:\2. USERS\Asri\MACC New Name\2010-08-12\HD001Y0\)
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.CopyFolder PathName, "Y:\2. USERS\Asri\testing\" <<<<<< it keeps giving "path not found error even when i have tried it with "C:\"
    End Sub

  4. #4
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Helped! Tried to copy folder into another folder but failed

    Thanks Patel, managed to find the issue.

    Do u happen to have any idea if i wanted to copy multiple folders?

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Helped! Tried to copy folder into another folder but failed

    Thanks Patel, managed to find the issue. - How please ?

    Do u happen to have any idea if i wanted to copy multiple folders? - explain better please

+ 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. search for a file in a folder based on data, copy and paste it in another folder
    By kboy1289 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-05-2013, 11:47 AM
  2. [SOLVED] VBA Code open files in folder, copy text to workbook-Next time folder opened copy only new
    By Bikeman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-02-2013, 07:59 PM
  3. When i Copy Folder to new destination i lose customised folder icon/picture
    By sternboy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-29-2012, 09:30 PM
  4. [SOLVED] Create a new folder based on a cell name or value and save copy onto that folder
    By Le_Tiago in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-20-2012, 01:33 PM
  5. create a compressed folder or zipped folder then copy workbooks to it.
    By Ironman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-04-2012, 03:56 PM

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