Results 1 to 8 of 8
  1. #1
    LukeBatty is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    6

    Exclamation Copying files using a file dialog to select them

    Private Sub Command5_Click()


    Dim mydlg As Office.FileDialog
    Dim FSO As Object
    Dim ServerReport As String

    ServerReport = DLookup("Test_Field", "Test", "ID = 1")
    Set mydlg = Application.FileDialog(msoFileDialogFilePicker)
    With mydlg
    .AllowMultiSelect = True
    .Title = "Select .xml folder to import"


    .InitialFileName = CurrentProject.path
    .Filters.Clear
    .Filters.Add ".xml", "*.xml*"
    If .Show = -1 Then
    For Each vrtSelectedItem In .SelectedItems
    Next
    Else
    MsgBox "You must select an excel file to import into access table", vbOKOnly + vbInformation, "Excel"
    Set mydlg = .SelectedItems
    End If

    Set FSO = CreateObject("scripting.filesystemobject")

    FSO.CopyFile Source:=mydlg, Destination:=ServerReport
    MsgBox "You can now find the server reports in " & ServerReport, vbInformation, "Server Report"

    End With


    End Sub

    I am trying to select xml files using a file dialog to then move them to another folder defined in my access database, but i can't seem to find a way that will copy the files to the folder and also before the files are moved they need to be extracted from a zip file Thank in Advance Luke B.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Google: vba open zip file extract
    http://excelexperts.com/Unzip-Files-using-VBA
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    LukeBatty is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    6
    Ok thats fine i understand that, but i dont know how to copy files over using filedialog to select them and move them

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Open the browse window for the user to select a file: http://www.minnesotaithub.com/2013/0...cess-with-vba/

    To copy a file: FileCopy from_path_file, to_path_file

  5. #5
    LukeBatty is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    6
    Thanks for that

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Do you need to copy the zip folder or just its contents? User selects the zip folder with dialog then code extracts the contents and saves to designated location.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    LukeBatty is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2017
    Posts
    6
    Quote Originally Posted by June7 View Post
    Do you need to copy the zip folder or just its contents? User selects the zip folder with dialog then code extracts the contents and saves to designated location.
    Sorry for the slow reply, This is exactly what I was on about, if you have a solution that would be greatly appreciated.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Google: Access extract zip

    Here is one https://expertosmicrosoftaccess.com/...mmicrosoftvba/
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Copying files from outside sources
    By Lou_Reed in forum Access
    Replies: 31
    Last Post: 12-05-2016, 08:06 AM
  2. Replies: 22
    Last Post: 02-22-2014, 02:51 PM
  3. Replies: 5
    Last Post: 01-30-2012, 01:14 PM
  4. Copying and Rename of Files based on fields
    By desk4tbc in forum Programming
    Replies: 2
    Last Post: 06-28-2011, 11:00 AM
  5. Copying multiple files?
    By daveofgv in forum Programming
    Replies: 3
    Last Post: 04-14-2011, 03:18 PM

Tags for this Thread

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