+ Reply to Thread
Results 1 to 4 of 4

VBA to MOVE pdf files between 2 folders

  1. #1
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    VBA to MOVE pdf files between 2 folders

    Its been a while since coming here as I have managed to solve many Excel VBA problems I have had but can not get my head around this.
    The following problem is during using Excel 2003 SP3 on a Windows 7 64 bit machine.
    I find this version of Excel much easier to work with but reading around the internet believe this issue may affect all versions of Excel & VBA.

    I must admit, this code is not all my own work, some had been found looking on the net and this site, the principle is still the same though.

    I am trying to move one file at a time between 2 folders using VBA, the file choice is listed including the file extension down an Excel column and
    produced by running another code which looks inside a folder and lists its contents.

    When I right mouse click the cell with a file name in, it uses the cell contents as its string then is supposed to move the file.
    I have tried this on TXT files and PDF files and this does work but only works the first time, I have tried clearing the cache, clipboard etc but still
    can not get the macro to run move 2 files one after the other.

    Is there a limit to the size of file VBA can move or is it something I am not doing right.

    if anybody has experienced anything like this and have managed to find a solution, please can you assist.

    In the Worksheet Objects I have written the following:

    HTML Code: 
    For the macro I have written the following:

    HTML Code: 
    I have written within the macro where the folder locations are.

    Hopefully is something I am missing.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA to MOVE pdf files between 2 folders

    Maybe this:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    Re: VBA to MOVE pdf files between 2 folders

    Hi, have run your code but get a run-time error '424', Object required as soon I right-click a cell containing a file name to move.

    Unsure how to rectify at present.

    Thanks

  4. #4
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    225

    Re: VBA to MOVE pdf files between 2 folders

    I have solved the issue - instead of trying to move the file, I have copied the file to the destination path then deleted the original file, this seems to work time after time, I have put the below code from the Macro ( the worksheet object remains the same as before ).

    HTML Code: 
    This code seems to copy any particular file from a source folder to a destination folder and works fine on a Windows 7 - 64 bit machine running Excel 2002 and VBA version 6.3


+ 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. Copy and Move files and folders (Date-Time)
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2014, 10:32 AM
  2. Move Excel files from multiple folders to one
    By Azzzman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-04-2013, 10:21 AM
  3. How to Move specific files to folders with VBA
    By EnzioL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2012, 06:46 AM
  4. Create folders and move and copy files into that folders
    By vijaybharthi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-31-2010, 04:01 AM
  5. Create Folders and Move Files Using VBA/MACRO
    By cjconnor24 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-17-2010, 07:20 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