+ Reply to Thread
Results 1 to 10 of 10

Copy file PDF/DWG/DXF from local server to a PC specific folder

  1. #1
    Registered User
    Join Date
    12-07-2022
    Location
    Italy
    MS-Off Ver
    Microsoft 365 for Business
    Posts
    8

    Question Copy file PDF/DWG/DXF from local server to a PC specific folder

    SEARCH AND COPY.xlsm

    Hi all

    I've an Excel file with VBA macro inside...I use this file to search and copy specific files into a local nas server.

    The problem is that the macro is configured to search in a specific location on the server nas
    Please Login or Register  to view this content.
    But I want the macro to search both in "Archivio Disegni" and also in its sub folders... As you can see on the atthached file, the sSourcePath is
    Please Login or Register  to view this content.
    , so it is set to search in the specific DV! folder in Archivio Disegni,...and I "simply" want the macro to search in both in "Archivio Disegni" and also in its sub folders...all the file i'll serach has unique name, such as DV0001 and so on...every file I search has a unique name, so it's impossible to have duplicate file errors etc

    The excel file is then set to return "not exist" if the file does not exist on the server, or PDF copied if it exists, etc as you can see in the attached file. but this is already working

    This is the macro I have
    Please Login or Register  to view this content.
    Can someone help me with this, I cannot find any solution since i'm not that good with VBA.

    Thanks all
    Best Regards
    Luca
    Last edited by luca_061088; 12-14-2022 at 04:06 AM.

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Copy file PDF/DWG/DXF from local server to a PC specific folder

    Not tested, but possibly...
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-07-2022
    Location
    Italy
    MS-Off Ver
    Microsoft 365 for Business
    Posts
    8

    Re: Copy file PDF/DWG/DXF from local server to a PC specific folder

    Quote Originally Posted by dangelor View Post
    Not tested, but possibly...
    Please Login or Register  to view this content.

    Hi dangelor, the code does give me any error, but seems he wont search and copy anything...he always give me pdf does not exist. Even if I change the source path. And I'm sure the file exist in the Archivio Disegni folder or subfolders

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Copy file PDF/DWG/DXF from local server to a PC specific folder

    Run this code and let me know if any filenames are listing in the message box.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-07-2022
    Location
    Italy
    MS-Off Ver
    Microsoft 365 for Business
    Posts
    8

    Re: Copy file PDF/DWG/DXF from local server to a PC specific folder

    Yes, a list with some files appears

    I retryed to run the code, changing the destination path as I see that was incorrect, and the macro run correctly, it copy the files...but...if I put in sSourcePath only
    Please Login or Register  to view this content.
    without specifying any subfolders, the macro wont copy any files...it seems that the macro does not search even in the subfolders of the Archivio Disegni....the excel returns me "pdf does not exist" in the dedicated cells of the excel file...it seems that it does not take into account any subfolders of Archivio Disegni

    but if I run the macro with
    Please Login or Register  to view this content.
    in the sSourcePath, for example, the macro run correctly copying the listed files

    the macro should be able to search both in the Archivio Disegni and also in its subfolders... Eventually it would also be sufficient for the macro to search only in the Archivio Disegni subfolders as a last chance if we can't figure it out I hope I explained myself correctly

    I don't want to disturb you too much, in fact I thank you for your availability
    Last edited by luca_061088; 12-13-2022 at 11:47 AM.

  6. #6
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Copy file PDF/DWG/DXF from local server to a PC specific folder

    I guess that shell doesn't work on a network. I'll see if I can come up with a different approach.

  7. #7
    Registered User
    Join Date
    12-07-2022
    Location
    Italy
    MS-Off Ver
    Microsoft 365 for Business
    Posts
    8

    Re: Copy file PDF/DWG/DXF from local server to a PC specific folder

    I also have this code

    Please Login or Register  to view this content.
    that seems to work, the problem with this is the space in the Archivio Disegni name that gives me an error, in fact if I change the path with example "\\nas01\scanner" it works, and the macro search for files in all its subfolders. Maybe there is a way to not let the macro read the space in the path Archivio Disegni... maybe this can help you in some way
    Last edited by luca_061088; 12-14-2022 at 03:08 AM.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Copy file PDF/DWG/DXF from local server to a PC specific folder

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    (Note: this requirement is not optional. As yo are new here, I shall do it for you this time: https://www.forumexcel.it/forum/thre...6/#post-511038)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Registered User
    Join Date
    12-07-2022
    Location
    Italy
    MS-Off Ver
    Microsoft 365 for Business
    Posts
    8

    Re: Copy file PDF/DWG/DXF from local server to a PC specific folder

    Hi AliGW

    I have read all the rules and I apologize for what happened. I posted on this forum after I had confirmation on the other forum you mentioned from Moderator alfrimpa on 7 December 2022 within the post itself. I didn't think I had to post the post from the other forum as a link here as well.

    Thanks for the notice and I apologize again
    Last edited by luca_061088; 12-14-2022 at 04:12 AM.

  10. #10
    Registered User
    Join Date
    12-07-2022
    Location
    Italy
    MS-Off Ver
    Microsoft 365 for Business
    Posts
    8

    Re: Copy file PDF/DWG/DXF from local server to a PC specific folder

    hello dangelor is there any news on this? I take this opportunity to wish you a Merry Christmas

+ 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. [SOLVED] need a VBA code to open, and save a file in specific folder using cell file paths
    By JSD100 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-27-2022, 10:49 AM
  2. Replies: 8
    Last Post: 12-02-2019, 03:42 PM
  3. Copying worksheets from specific folder into a specific file
    By RavindraK in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-19-2019, 02:14 PM
  4. Macro to copy server file into local folder, and change data sources to this new file
    By rickywangca in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-18-2019, 11:18 AM
  5. [SOLVED] Open newest folder and specific file in the folder
    By timtim91 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2017, 11:55 AM
  6. [SOLVED] Save as xlsm file with specific name & specific folder
    By namialus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2015, 03:32 AM
  7. Replies: 4
    Last Post: 12-30-2011, 11:24 AM

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