+ Reply to Thread
Results 1 to 12 of 12

Vba to copy a file from a network path and place it to another network path location

  1. #1
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    726

    Vba to copy a file from a network path and place it to another network path location

    Can someboday provide me a code which ask to browse a file then paste that file to a given network location path

    Plz assisst

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Vba to copy a file from a network path and place it to another network path location

    Use FileCopy or Name.
    Ex:
    Please Login or Register  to view this content.
    Combine it with FileDialog to allow browsing/selection.

    Something like below for copy files.
    Please Login or Register  to view this content.
    If moving file(s) to another location... use Name instead of FileCopy
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    726

    Re: Vba to copy a file from a network path and place it to another network path location

    mid code i am using but thats giving compilation error:

    FileCopy .SelectedItems(i), dest & "\" & x

    "constant expression required"

    where to put fix destination path

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Vba to copy a file from a network path and place it to another network path location

    Below line. Edit "C:\Test" to your actual destination.
    Please Login or Register  to view this content.
    It should be at beginning of the code.

  5. #5
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    726

    Re: Vba to copy a file from a network path and place it to another network path location

    HTML Code: 
    using it like this but only sir but the same error

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Vba to copy a file from a network path and place it to another network path location

    Hmm? Works fine on my end.

    Try changing Const ... line to something like...
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    726

    Re: Vba to copy a file from a network path and place it to another network path location

    yes sir now its working fine

    can we add a msg box to display that pasting complete ...

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Vba to copy a file from a network path and place it to another network path location

    Just put msgbox code after End With.

    Something like...
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    726

    Re: Vba to copy a file from a network path and place it to another network path location

    thanx alot sir

  10. #10
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    726

    Re: Vba to copy a file from a network path and place it to another network path location

    FileCopy .SelectedItems(i), dest & "\" & x

    Now its giving error here: compile error
    Argument not optional

    Kindly assist

  11. #11
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Vba to copy a file from a network path and place it to another network path location

    I can't replicate your issue on my end.

    Try constructing string prior to using it in the argument?

    Ex:
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    03-11-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    726

    Re: Vba to copy a file from a network path and place it to another network path location

    Ok sir thanx issue resolved

+ 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. vba code to open xlsm file from Network Path
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-06-2014, 04:18 AM
  2. Excel VBA get Network path from local path
    By katto01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2013, 11:31 AM
  3. Copy files from VM Ware to the local or the network path usign Excel Macro
    By kumarvivek07vit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2013, 10:28 AM
  4. Changing path to a network location
    By talksalot81 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2011, 12:10 PM
  5. Network Drive Path
    By smarta in forum Excel General
    Replies: 3
    Last Post: 04-19-2007, 11:14 AM
  6. [SOLVED] Path to a network drive
    By CWillis in forum Excel General
    Replies: 2
    Last Post: 06-22-2006, 10:10 PM
  7. Help with path for shared folder on network
    By rrmando in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-12-2005, 09:54 PM

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