By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

Import file

P: 4
Hi all,
i'm very new to access and VB so please need your help.
can i Import csv (Comma Separated Value) File by browsing my computer instead of specifying an exact file path for the file ???

Thanks for you cooperation
May 20 '07 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,633
Hi all,
i'm very new to access and VB so please need your help.
can i Import csv (Comma Separated Value) File by browsing my computer instead of specifying an exact file path for the file ???

Thanks for you cooperation
Code to Browse for Comma Separated Value (*.csv) Files only. Must first set a Reference to the Microsoft Office XX.X Object Library.
Expand|Select|Wrap|Line Numbers
  1. Dim FileName As String
  2. Dim result As Integer
  3. With Application.FileDialog(msoFileDialogFilePicker)
  4.   .Filters.Clear
  5.   .Title = "Choose file"
  6.   .Filters.Add "Comma Separated Value", "*.csv"
  7.   .FilterIndex = 1
  8.   .AllowMultiSelect = False
  9.   .InitialFileName = "c:\"
  10.   result = .Show
  11.     If (result <> 0) Then
  12.       FileName = Trim(.SelectedItems.Item(1))
  13. (FileName, "\"))
  14.       MsgBox "Selected File is: " & FileName
  15.     End If
  16. End With
May 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.