UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Access Vba- Import Xlsx Or Csv From Folders, Access 2013    
 
   
JoaoFigu
post Dec 3 2019, 11:44 AM
Post#1



Posts: 2
Joined: 19-March 19



I need button to seach in folders if there is a XLSX or CSV file and import to a table, i were trying this code for each folder.

Sub Import_files2me()

Const strPath As String = "C:\COCFAT\99_input\CDT" 'Directory Path 1
Dim strFile As String 'Filename
Dim strFileList() As String 'File Array
Dim intFile As Integer 'File Number

'Loop through the folder & build file list
strFile = Dir(strPath & "*.xlsx")
While strFile <> ""
'add files to the list
intFile = intFile + 1
ReDim Preserve strFileList(1 To intFile)
strFileList(intFile) = strFile
strFile = Dir()
Wend
'see if any files were found
If intFile = 0 Then

MsgBox "Năo existem ficheiros na pasta CDT"
If MsgBox("Quer continuar?", vbYesNo + vbQuestion) = vbYes Then
Else
Exit Sub
End If
End Sub
Go to the top of the page
 
theDBguy
post Dec 3 2019, 11:46 AM
Post#2


UA Moderator
Posts: 76,866
Joined: 19-June 07
From: SunnySandyEggo


Hi. Welcome to UtterAccess! welcome2UA.gif

Just FYI, this is crossposted here. Cheers!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    11th December 2019 - 09:33 AM