Results 1 to 4 of 4

Hard code CSV file path?

  1. #1
    stalk is offline Advanced Beginner
    Windows 8 Access 2003
    Join Date
    May 2014
    Posts
    87

    Hard code CSV file path?

    What changes do I need to make to point to the directory path( hardcode path) but let the user select one csv file


    to read and process

    Dim f As object
    Dim varItem as Variant
    Set f=Application.FileDialog(3)
    f.AllowMultiSelect= True
    If f.show Then
    For each VarItem In f.SelectedItems
    StrFilename = Di(VarItem)
    StrilePath = StrInfie& Strfilename
    Next
    End If

    For Ex: Directory= c:\temp\CsvFiles

    Thank you

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,254
    f.InitialFileName = "C:\temp\CsvFiles\"

    If they should select only 1 file, then set AllowMultiSelect to False.
    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
    Ajax is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    7,554
    you might also want to restrict the user to selecting .csv files. in which case include the lines

    f.filters.clear
    f.Filters.Add "Comma Separated Values", "*.csv, *.txt"

  4. #4
    stalk is offline Advanced Beginner
    Windows 8 Access 2003
    Join Date
    May 2014
    Posts
    87
    Thank you Both it worked as desired

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

Similar Threads

  1. Replies: 0
    Last Post: 10-10-2018, 12:28 PM
  2. Really - just how hard is this to code???
    By DubCap01 in forum Programming
    Replies: 11
    Last Post: 02-07-2017, 02:32 PM
  3. save as prompt with hard code path
    By xopherira in forum Programming
    Replies: 8
    Last Post: 09-09-2015, 12:57 PM
  4. Replies: 2
    Last Post: 12-21-2012, 04:59 PM
  5. View .txt file on hard drive
    By nfaunt in forum Programming
    Replies: 0
    Last Post: 04-04-2011, 09:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums