Results 1 to 8 of 8
  1. #1
    focosi is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    97

    save folder to another directory

    I would like the VBA code to save a list of files from a folder to another directory on removable drive using the Save As file dialog. I have found this http://access.mvps.org/access/api/api0001.htm but i cannot manage where and how to list the files I want to copy.


    Also, is there any chance to select the default directory where the save as file dialog starts at ?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Did you notice this line:
    Optional ByVal InitialDir As Variant, _

  3. #3
    focosi is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    97
    Thanks for the hint. But where should I write the list of files to be copied ? Or am I forced to copy files one by one ???

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Once you have the Destination you can just use a Loop to copy all of the files you want.

  5. #5
    focosi is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    97
    ok, but... what is a Loop and how should I use it ??
    Could you please post a VBA example ?
    Sorry for my ignorance....

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    look at using the filesystemobject procedures.

    With filesystemobject you can look at all files in a folder copy all or some of the files using wildcards etc to a new destination. If you have a lot of files do you really want to open a 'save as' dialog box for every file or do you just want to do a mass copy?

  7. #7
    focosi is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    97
    I would like to do a mass copy.
    Any VBA example, please?

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Look at filesystemobject code, it's very easy to deal with and there are TONS of resources available. I don't know your situation so I can't really give you code but here are some resources:

    copying an entire folder
    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

    copying a single file
    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

    cycling through files in a folder
    http://www.4guysfromrolla.com/webtec...ect/faq5.shtml

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

Similar Threads

  1. open folder/Make new folder(example)-VBA Code
    By Madmax in forum Code Repository
    Replies: 3
    Last Post: 03-13-2012, 09:17 AM
  2. Replies: 6
    Last Post: 06-15-2011, 04:38 PM
  3. Replies: 9
    Last Post: 05-30-2011, 12:08 PM
  4. Enter a folder name and open that folder
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 09-05-2010, 04:39 PM
  5. Make directory or folder
    By thart21 in forum Programming
    Replies: 1
    Last Post: 04-07-2010, 05:37 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