Export To MULTIPLE CSV Files

Mar 10, 2008

Hello All,
I am trying to export a query to multiple .csv files.. For example...

Export1.csv = rows 1-1500
Export2.csv = rows 1501-3000
Export3.csv = rows 3001-4500

and so on until all rows have been exported...

Anyone have any idea what the best way to approach this is?

I'm sure many people will find this usefull because some exports can be over the 65000 limit of ms excel.

View Replies


ADVERTISEMENT

Access Query - Export To Multiple Excel Files

May 21, 2015

I have a basic access query (MACs Report Template) that I need to export into multiple excel files based on the 1st field (Plan ID).

Example:

PLAN ID
Number
Amount
Status

AM141
12345
100
Disconnected

AM141
54321
5000
Active

AM142
11122
2000
Disconnected

AM155
22334
500
Disconnected

I need this to create a spreadsheet for each unique PLAN ID. Ideally i want it to export the following:

MACs Report AM141 20150521.xls (both records above should be in this report)
MACs Report AM142 20150521.xls
MACs Report AM155 20150521.xls

View 3 Replies View Related

Export The Export/import Specifications For Text Files

May 10, 2007

Hello,
Does anyone knows how can I export the export/import specifications (which file/directory) and how can I import/export the specifications between different versions of Access. Thanks!

View 3 Replies View Related

Problem With Module To Export Several Files To .rtf Documents

Sep 20, 2006

Here is my function :


Private Sub Commande4_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim BaseSQL As String
Dim strSQL As String
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT DISTINCT [Dealer/Distributor Number] FROM Query_Active_Dealer_List_Update")
Set qdf = dbs.QueryDefs("Query_Active_Dealer_List_Update")
BaseSQL = qdf.SQL
With rst
Do Until .EOF
strSQL = Left(BaseSQL, Len(BaseSQL) - 3) & " WHERE [Dealer/Distributor Number] =" & ![Dealer/Distributor Number]
qdf.SQL = strSQL
DoCmd.OutputTo acOutputReport, "Main_Report", "RichTextFormat", "C:Documents and SettingslarocmaDealer_Scorecards" & ![Dealer/Distributor Number] & ".doc"

.MoveNext
Loop
.Close
End With
qdf.SQL = BaseSQL
Set qdf = Nothing
Set rst = Nothing
Set dbs = Nothing

End Sub

The problem is in the line containing : strSQL = Left(BaseSQL, Len(BaseSQL) - 3) & " WHERE [Dealer/Distributor Number] =" & ![Dealer/Distributor Number]

If I let ![Dealer/Distributor Number] this way I get an error and no report generated. But if I put "[Dealer/Distributor Number]" in a parameter, and I enter the dealer numbers by hand, I get good working reports. Dealer/Distributor Number are not nul. Main_Report is a report containing many sub_reports grouped by Dealer/Distributor Number. The query I linked to the function is the query I use on the main report to get the information about each dealership.

View 1 Replies View Related

General :: Export Rows Into Individual Text Files?

Jul 23, 2012

I have a table that has over 6000 rows with two columns. One a title and the other a memo column with transcripts from interviews (some being extremely long). I do research using content analysis and to do that on these interviews, I need each one saved in its own text file.

Specifically I need to export each transcript into its own text file and save that file using the title from the other column. So I would end up with over 6000 text files all being saved using the title from the corresponding row as the transcript. Is this even possible?

View 14 Replies View Related

Modules & VBA :: Import Multiple Files To Multiple Tables On Button Click

Sep 20, 2014

I made a database that in one of the forms, I like by clicking on a button the user be able to select 5 excel files with different file names (in the same directory) and then based on the imported file's names, it be stored in 5 different tables.

At the moment by using the bellow code, I can import multiple files (with the same formats) only into one table . My vba code comes as follow:

Function GetAllFiles()
Dim fd As Object
Dim strFilter As String
Dim lngItems As Long

Const msoFileDialogOpen As Long = 3
Const msoFileDialogViewDetails As Long = 2

[Code] ....

View 4 Replies View Related

Modules & VBA :: Import Multiple Fix Width Text Files - Eliminate Multiple Headers And Footers

Aug 1, 2013

I am trying to build a newer database 2010, based on an older one,2000, that has been locked tight and I cannot see the modules to kinda get a reference of where to start. I am trying to find a VBA code that will allow me to import a several text files to one table. The text files are all in the same format but I cannot remove the page headers and footers to get the table to look right. I have attached an example of the text file i am trying to import but it is a stripped down version for information protection.

Also, it appears in the old Database Table once imported as:

J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date

If I could import the text files and end up with a table like this, it would be all i need as i could run all the queries i need from this.

View 3 Replies View Related

General :: Export Access Table To Multiple Excel Workbooks With Multiple Tabs

Dec 13, 2012

I am using Access 2010 and Excel 2010. I need to have VB script to export the access table 502 records by 38 fields into Multiple Excel workbooks each having multiple tabs. In the Access table each record has two fields: Div and Tab that will be used to name each workbook and each tab (sheet). There are 6 unique "Div"'s to name the 6 workbooks and there are several "Tab" names for each Div (workbook).

Note: These 6 workbooks with multiple tabs were originally imported into Access from one common folder on my desktop by this routine:

Option Compare Database
Option Explicit
Private Sub Command1_Click()
Dim blnHasFieldNames As Boolean, blnEXCEL As Boolean, blnReadOnly As Boolean
Dim lngCount As Long

[Code] .....

View 7 Replies View Related

Export Access Table To Multiple Excel Workbooks With Multiple Tabs (sheets)?

Dec 13, 2012

I am using Access 2010 and Excel 2010. I need to have VB script to export the access table 502 records by 38 fields into Multiple Excel workbooks each having multiple tabs. In the Access table each record has two fields: Div and Tab that will be used to name each workbook and each tab (sheet). There are 6 unique "Div"'s to name the 6 workbooks and there are several "Tab" names for each Div (workbook).

Excel workbooks would take names from the "Div" field and the tab names would come from the "Tab" field in the Access table. First need to find workbook name (Div - Field) then the look for each sheet name (Tab - Field) to create 1st Excel workbook with all the sheets (Tab) and repeat the process. I think you need to approach of read the Access table one record at a time keying on the "Div" and "Tab" fields in creating each Excel workbook with the associated multiple tabs (sheets) that are written to a common folder.

Note: These 6 workbooks with multiple tabs were originally imported into Access from one common folder on my desktop by this routine.

Option Compare Database
Option Explicit
Private Sub Command1_Click()
Dim blnHasFieldNames As Boolean, blnEXCEL As Boolean, blnReadOnly As Boolean
Dim lngCount As Long
Dim objExcel As Object, objWorkbook As Object
Dim colWorksheets As Collection

[code]....

View 12 Replies View Related

How To List Multiple Files In Multiple Subfolders

Nov 14, 2005

Does anyone out there know how I might do the following:

I have a main folder which contains many sub-folders. In turen, each subfolder contains several files. I am interested in creating a text file that within each sub-folder will list certain files in that sub-folder. Example:

"Main Folder"
"Sub-folder 1"
FileA
FileB
FileZ
"Sub-folder 2"
FileA
FileB
"Sub-folder 3"
FileA
FileB
FileZ

Pseudo-code:

Read Main Folder
Do While Sub-folders exist
Do while selected sub-folder contains files
If selected sub-folder contians FileZ then
Write selected sub-folder name to text file
Write time/date stamp to text file
else
loop to next ub-folder
end if
end do while
end do while
Close input and output

Any help offered is greatly welcome. Thank you!!

View 7 Replies View Related

Email Multiple Files

Jan 30, 2008

I think this was covered a while back and I did a search and couldn't find anything on it; Is there a way to attach and send multiple report .snp's to one email. I've been using SendObject.

thanks -

View 14 Replies View Related

Multiple Files Into One Table

Jan 7, 2005

Hi, I'm new to Access, but I think I've been doing fairly well. At my job, we use multiple Word tables and excel spreadsheets to keep track of information on journals we subscribe to. (I work in the periodicals/serials department of the university library.) We have a LOT of journals and a lot of information on each one.

I have already imported our "superholdings" file, which includes the names of the journals and a few bits of information on each one. What I want to do is import other bits of information from the other files into that same table. I tried importing the files into the existing table, but rather than merging all of the data for each journal title, it simply added the new records to the bottom. I tried importing the files as new tables and joining the tables with the title fields, but that didn't do what I wanted.

Really, I just want to merge all of the data. If the Title's match exactly, then I want all of that information in one record for that title. I have been VERY consistent with field names.

I'm new to Access, but I learn fairly quickly. I notice on this forum (I've read a LOT of the posts looking for answers to this question, and got answers for other questions) that most of the solutions involve coding or programming of some sort. I have NEVER done this in access. If the solution to my problem involves this, please tell me where I'm supposed to type those commands. I'm somewhat familiar with softcode (from a mux (talker environment) I started frequenting in college), but never have programmed anything. (Not since basic on our old IBM XT!!)

Okay, an example is forthcoming, once I figure out how to do it in this little window.


Thanks,
Siena

View 8 Replies View Related

Merging Multiple MDB Files Into One

Apr 4, 2014

We've got a software that is creating a mdb file with one table and 10 columns. Every day we have around 30.000 entries in the table. At the end of the week we have 7 different mdb files and usually we copy/paste them into one single file to do the base research. Everything is fine until the mdb's file size is 2GB. I understand that mdb files start behaving strange with files over 2GB of size. Therefore after a couple of months we have several 2GB mdb files. When doing a history research we have to open each and every file to check and search in that file. That can take a lot of time if you have 20 or more mdb files.

What I am asking is ... if there is a possibility to merge all the 2GB files into one or maybe more so that the research wouldn't take so much time.

View 2 Replies View Related

Importing Multiple Csv Files Into Table

Jul 19, 2005

I have been given the task of setting up a database which will store data which I will receive on a month basis, I have managed to import some csv files however, I will be receiving well over 200 csv files each month. Is there a way to import these multiple file.

The filename save structure is as follows: areacode-Jul 05data.csv

areacode represents each different area.

below is a copy of the csv file.....

View 2 Replies View Related

Multiple Access To Linked .txt Files?

Feb 8, 2006

We've had a problem for quite a while with regards to multiple users being able to view/run, queries/reports at the same time.
If someone is running a query/report, and then someone attempts to use any other query/report that’s already using the linked .txt file they get the error message:

The Microsoft Jet database engine cannot open the file ". It is already opened exclusively by another user, or you need permission to view its data.


I've read various posts with regards to user rights to the folder which the DB is stored, which isn't the problem in this case (we have tested and set user access to all read, write, delete etc).

I've also read that .txt files are managed in a different way than most other file types, in that DOS controls user access rather than jet?

So my question is:
Is there a way round this issue with linked tables that use .txt file as there source?

Thanks

Darren

View 2 Replies View Related

Import Multiple .csv Files To Access

Mar 3, 2006

Hi I have a few .csv files that i would like to upload into an access db. I saw an example for DTS, but since i dont have sql server i can't go that route.

Since i have some .csv Files where the file name changes on a daily basis, is it possible to upload them all with some wild card function. there is already a table with the fields already predetermined, and all i basically have to do is just load them all up at once.

please let me know if you have a solution.

View 2 Replies View Related

Importing Multiple Text Files

Aug 1, 2006

I am trying to import several txt from a directory.

The following code is on a button in a form:

Private Sub ImportData_Click()

Dim myfile
Dim mypath

mypath = "G:FinanceAccountingRoyalty2006exports3rd QTR 06JUL 06 est"
Do
myfile = Dir(mypath & "*.txt")
DoCmd.TransferText acImportFixed, "import_data", "tbl_import_tables", mypath & myfile, False, ""
myfile = Dir
Loop Until myfile = ""

End Sub

The problem is this causes a infinite loop

Can anyone help?? Thanks

PS This code was from previous posting, where the transfer was excel files.

View 5 Replies View Related

Import Multiple Excell Files

Jan 16, 2008

Super new to the forums and hoping I can find an answer here.
After looking for an hour or so on Microsoft's site, I gave up and decided to venture into new resources.

My ultimate goal is to create a form that will prompt a user to select a Microsoft Excel file and then run a macro. The macro should import the Excel file into a single table based off of what form is being run. The idea is to have a single form for each employee of a specific department and have the form import information that is stored on our phone server into access. I've set up most of the macro but the argument section of the filename is what's hanging me up.

So finally my question;
Is there a way to have a macro run to specify what file you want to import when using an additional macro? Am I going about this the completely wrong way and should stick to VB Code?

I look forward to your responses, thank you in advanced!

View 4 Replies View Related

Modules & VBA :: FTP Multiple Files Using Loop

May 15, 2014

Basically what I am trying to accomplish is uploading multiples file automatically into server. The code I am trying to use works great if the user wants to upload a single file manually because the code prompts you to choose the file and I am wondering if there is a way to tweak the code. here is the code I am using

Code:
Private Sub Form_Load()
Dim objFTP As FTP
Dim strfile As String

[Code].....

View 3 Replies View Related

Modules & VBA :: Printing To Multiple PDF Files

Jul 8, 2013

My report has tens of pages and I need to save each page as separate file with ID as filename. PDF prints with ID but all in one file. I use this code.

Option Compare Database
Private Sub tisk()
Dim cesta As String
Dim kod As String
Dim Sql As String
Dim rs As Recordset

[Code] ....

View 5 Replies View Related

Automate Import Of Multiple DBF Files

Sep 7, 2013

I've been asked importing about 50 - 60 .DBF files into an Access database daily - and processing the data in Access to specs I don't have yet.

I'm pretty comfortable doing whatever once I have the data in the Access Database.

View 8 Replies View Related

Can I Batch Import Multiple Excel Files?

Jun 22, 2007

I have 100 or so 2-sheet excel workbooks. I need to import them all into an access table for analysis. They are all exactly the same format/layout etc but obviously have different data in them (they are customer satisfaction surveys). I only want to export 1 out of the 2 sheets on each workbook (the other is a front end, the data sits behind in sheet 2).

So, at the moment I have to go to 'get external data' > 'import' > select excel and then double click each file individually and then go through the import wizard. Now, I can get them all into one table but it's clearly time consuming.

Is there anyway of doing a batch import of multiple excel files to cut out the manual work described above? Or can anyone suggest a lateral get around?

Any help much appreciated. I should say that I am running excel 2003 and access XP (2002)

Matt

View 5 Replies View Related

Exporting Multiple Csv Files From A Single Table

Mar 19, 2008

Hi guys. I'm a bit of a noob with Access. I have a table which is 15 rows by 250,000 columns. So there are about 3.75m records.

What I need to do is to get access to export a number of csv files automatically from this table.

I need each csv file to contain all the data in the table for a certain range of rows. This is determined by a value in a particular column. This is a sample of the table.

http://i30.tinypic.com/aljf5s.jpg


Basically Store_Nbr represents a UID for a particular store. All the data is currently in one big table, and I need a single csv file for each different store_nbr (so it contains all the data in the table for each unique store). Also, for each store_nbr, there are different Year Month of Surveys. For each store_nbr, I need a different csv file for each Year Month of Survey. This will probably divide up the 250,000 long table into about 200 csv files, as there are about 50 different Store_nbrs, and there are 4 surveys for each individual store.

Sorry if I've not made myself perfectly clear.

I'm sure there's a simple way of doing it, but I really do suck with access and was wondering if you guys had any idea.

Many many thanks!!!

Cheers

View 4 Replies View Related

Select Multiple Files With Browse Window

May 25, 2007

Thanks to a previous post, I was able to adapt the below code to call up a browse window in my project. However, the browse window only allows one file to be called up at a time. I would like to find a way to select multiple files in the browse window and call them all up at once. Please help

'***************** Code Start **************
'This code was originally written by Ken Getz.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
' Code courtesy of:
' Microsoft Access 95 How-To
' Ken Getz and Paul Litwin
' Waite Group Press, 1996

Type tagOPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
strFilter As String
strCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
strFile As String
nMaxFile As Long
strFileTitle As String
nMaxFileTitle As Long
strInitialDir As String
strTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
strDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean

Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long

Global Const ahtOFN_READONLY = &H1
Global Const ahtOFN_OVERWRITEPROMPT = &H2
Global Const ahtOFN_HIDEREADONLY = &H4
Global Const ahtOFN_NOCHANGEDIR = &H8
Global Const ahtOFN_SHOWHELP = &H10
' You won't use these.
'Global Const ahtOFN_ENABLEHOOK = &H20
'Global Const ahtOFN_ENABLETEMPLATE = &H40
'Global Const ahtOFN_ENABLETEMPLATEHANDLE = &H80
Global Const ahtOFN_NOVALIDATE = &H100
Global Const ahtOFN_ALLOWMULTISELECT = &H200
Global Const ahtOFN_EXTENSIONDIFFERENT = &H400
Global Const ahtOFN_PATHMUSTEXIST = &H800
Global Const ahtOFN_FILEMUSTEXIST = &H1000
Global Const ahtOFN_CREATEPROMPT = &H2000
Global Const ahtOFN_SHAREAWARE = &H4000
Global Const ahtOFN_NOREADONLYRETURN = &H8000
Global Const ahtOFN_NOTESTFILECREATE = &H10000
Global Const ahtOFN_NONETWORKBUTTON = &H20000
Global Const ahtOFN_NOLONGNAMES = &H40000
' New for Windows 95
Global Const ahtOFN_EXPLORER = &H80000
Global Const ahtOFN_NODEREFERENCELINKS = &H100000
Global Const ahtOFN_LONGNAMES = &H200000

Function GetFile()
Dim strFilter As String
Dim lngFlags As Long
strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)", _
"*.MDA;*.MDB")
strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF")
strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
' MsgBox "You selected: " & ahtCommonFileOpenSave(InitialDir:="C:", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Hello! Open Me!")

GetFile = ahtCommonFileOpenSave(InitialDir:="C:", _
Filter:=strFilter, FilterIndex:=4, Flags:=lngFlags, _
DialogTitle:="Find File")
' Since you passed in a variable for lngFlags,
' the function places the output flags value in the variable.
'Debug.Print Hex(lngFlags)
End Function

Function GetOpenFile(Optional varDirectory As Variant, _
Optional varTitleForDialog As Variant) As Variant
' Here's an example that gets an Access database name.
Dim strFilter As String
Dim lngFlags As Long
Dim varFileName As Variant
' Specify that the chosen file must already exist,
' don't change directories when you're done
' Also, don't bother displaying
' the read-only box. It'll only confuse people.
lngFlags = ahtOFN_FILEMUSTEXIST Or _
ahtOFN_HIDEREADONLY Or ahtOFN_NOCHANGEDIR
If IsMissing(varDirectory) Then
varDirectory = ""
End If
If IsMissing(varTitleForDialog) Then
varTitleForDialog = ""
End If

' Define the filter string and allocate space in the "c"
' string Duplicate this line with changes as necessary for
' more file templates.
strFilter = ahtAddFilterItem(strFilter, _
"Access (*.mdb)", "*.MDB;*.MDA")
' Now actually call to get the file name.
varFileName = ahtCommonFileOpenSave( _
OpenFile:=True, _
InitialDir:=varDirectory, _
Filter:=strFilter, _
Flags:=lngFlags, _
DialogTitle:=varTitleForDialog)
If Not IsNull(varFileName) Then
varFileName = TrimNull(varFileName)
End If
GetOpenFile = varFileName
End Function

Function ahtCommonFileOpenSave( _
Optional ByRef Flags As Variant, _
Optional ByVal InitialDir As Variant, _
Optional ByVal Filter As Variant, _
Optional ByVal FilterIndex As Variant, _
Optional ByVal DefaultExt As Variant, _
Optional ByVal FileName As Variant, _
Optional ByVal DialogTitle As Variant, _
Optional ByVal hwnd As Variant, _
Optional ByVal OpenFile As Variant) As Variant
' This is the entry point you'll use to call the common
' file open/save dialog. The parameters are listed
' below, and all are optional.
'
' In:
' Flags: one or more of the ahtOFN_* constants, OR'd together.
' InitialDir: the directory in which to first look
' Filter: a set of file filters, set up by calling
' AddFilterItem. See examples.
' FilterIndex: 1-based integer indicating which filter
' set to use, by default (1 if unspecified)
' DefaultExt: Extension to use if the user doesn't enter one.
' Only useful on file saves.
' FileName: Default value for the file name text box.
' DialogTitle: Title for the dialog.
' hWnd: parent window handle
' OpenFile: Boolean(True=Open File/False=Save As)
' Out:
' Return Value: Either Null or the selected filename
Dim OFN As tagOPENFILENAME
Dim strFileName As String
Dim strFileTitle As String
Dim fResult As Boolean
' Give the dialog a caption title.
If IsMissing(InitialDir) Then InitialDir = CurDir
If IsMissing(Filter) Then Filter = ""
If IsMissing(FilterIndex) Then FilterIndex = 1
If IsMissing(Flags) Then Flags = 0&
If IsMissing(DefaultExt) Then DefaultExt = ""
If IsMissing(FileName) Then FileName = ""
If IsMissing(DialogTitle) Then DialogTitle = ""
If IsMissing(hwnd) Then hwnd = Application.hWndAccessApp
If IsMissing(OpenFile) Then OpenFile = True
' Allocate string space for the returned strings.
strFileName = Left(FileName & String(256, 0), 256)
strFileTitle = String(256, 0)
' Set up the data structure before you call the function
With OFN
.lStructSize = Len(OFN)
.hwndOwner = hwnd
.strFilter = Filter
.nFilterIndex = FilterIndex
.strFile = strFileName
.nMaxFile = Len(strFileName)
.strFileTitle = strFileTitle
.nMaxFileTitle = Len(strFileTitle)
.strTitle = DialogTitle
.Flags = Flags
.strDefExt = DefaultExt
.strInitialDir = InitialDir
' Didn't think most people would want to deal with
' these options.
.hInstance = 0
'.strCustomFilter = ""
'.nMaxCustFilter = 0
.lpfnHook = 0
'New for NT 4.0
.strCustomFilter = String(255, 0)
.nMaxCustFilter = 255
End With
' This will pass the desired data structure to the
' Windows API, which will in turn it uses to display
' the Open/Save As Dialog.
If OpenFile Then
fResult = aht_apiGetOpenFileName(OFN)
Else
fResult = aht_apiGetSaveFileName(OFN)
End If

' The function call filled in the strFileTitle member
' of the structure. You'll have to write special code
' to retrieve that if you're interested.
If fResult Then
' You might care to check the Flags member of the
' structure to get information about the chosen file.
' In this example, if you bothered to pass in a
' value for Flags, we'll fill it in with the outgoing
' Flags value.
If Not IsMissing(Flags) Then Flags = OFN.Flags
marty = strFile
ahtCommonFileOpenSave = TrimNull(OFN.strFile)
Else
ahtCommonFileOpenSave = vbNullString
End If
End Function

Function ahtAddFilterItem(strFilter As String, _
strDescription As String, Optional varItem As Variant) As String
' Tack a new chunk onto the file filter.
' That is, take the old value, stick onto it the description,
' (like "Databases"), a null character, the skeleton
' (like "*.mdb;*.mda") and a final null character.

If IsMissing(varItem) Then varItem = "*.*"
ahtAddFilterItem = strFilter & _
strDescription & vbNullChar & _
varItem & vbNullChar
End Function

Private Function TrimNull(ByVal strItem As String) As String
Dim intPos As Integer
intPos = InStr(strItem, vbNullChar)
If intPos > 0 Then
TrimNull = Left(strItem, intPos - 1)
Else
TrimNull = strItem
End If
End Function

View 1 Replies View Related

Queries :: Import Multiple Excel Files

Jul 17, 2014

I have been trying to write a macro that will do the following:

- Look to a specific folder in my home drive (nb this may change)
- select all of the excel files that are in that folder
- select various cells in each of those spreadsheets - each spreadsheet is formatted the same with the same structure. The cells are random, e.g. D6, I22, H4, K4, D17, so I cannot select a whole range
- copy these cells and paste them into one row of a database

View 3 Replies View Related

Modules & VBA :: Importing Multiple Text Files?

Dec 17, 2013

Currently I have a code that imports a single text file into a table without problems.

I need to be able to selecte multiple text files and import them at once.

Here is my current working code.....

Code:
Private Sub Import_Click()
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Text File (*.txt)", "*.txt")
strSaveFileName = ahtCommonFileOpenSave( _
OpenFile:=True, _
Filter:=strFilter, _
DialogTitle:="Please select new file...", _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
DoCmd.TransferText acImportDelim, "Import Specs", "Data Table", strSaveFileName, True, ""

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved