E
Erick C
I am having a problem, and I am hoping that someone may be able to
help me out. I currently have a table and a crosstab query that I
would like to put into different worksheets in the same spreadsheet.
This is the first part of my dilemma.
Now, here is the tricky part. I am making the Access database for
different users, who have NO Access or VBA experience at all. I have
made a form with buttons that a user can press in order to import
certain files into Access tables. When they press a button it opens a
dialog box that lets them select the folder and file to start the
import, and then it loops through all of the files in the folder and
imports the information. I copied the code from another discussion
forum that I ran into. I would like to use the same methodology for
my export. I would like to make a button on the form that allows the
user to choose the file that will have the info imported into
different worksheets, but I do not want the loop like I have now. The
current code loops through all files in the folder, I only want to
pick one file. Here is my current code attached to my form buttons:
Private Sub Command13_Click()
Dim strDirectory As String, strFilter As String
Dim strFileName As String, strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)",
"*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select a subinventory report to begin...", _
Flags:=ahtOFN_HIDEREADONLY)
strDirectory = Left(strInputFileName, _
InStrRev(strInputFileName, "\"))
strFileName = Dir(strDirectory & "*.xls")
Do While strFileName <> vbNullString
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"Subinventory Report", _
strDirectory & strFileName, True
strFileName = Dir()
Loop
End Sub
Can my request be done, and if so can someone point me in the right
direction? Please bear in mind I am still a novice when it comes to
VBA, but I am trying to learn as much as possible.
Any information that can be provided would be greatly appreciated.
help me out. I currently have a table and a crosstab query that I
would like to put into different worksheets in the same spreadsheet.
This is the first part of my dilemma.
Now, here is the tricky part. I am making the Access database for
different users, who have NO Access or VBA experience at all. I have
made a form with buttons that a user can press in order to import
certain files into Access tables. When they press a button it opens a
dialog box that lets them select the folder and file to start the
import, and then it loops through all of the files in the folder and
imports the information. I copied the code from another discussion
forum that I ran into. I would like to use the same methodology for
my export. I would like to make a button on the form that allows the
user to choose the file that will have the info imported into
different worksheets, but I do not want the loop like I have now. The
current code loops through all files in the folder, I only want to
pick one file. Here is my current code attached to my form buttons:
Private Sub Command13_Click()
Dim strDirectory As String, strFilter As String
Dim strFileName As String, strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)",
"*.XLS")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select a subinventory report to begin...", _
Flags:=ahtOFN_HIDEREADONLY)
strDirectory = Left(strInputFileName, _
InStrRev(strInputFileName, "\"))
strFileName = Dir(strDirectory & "*.xls")
Do While strFileName <> vbNullString
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"Subinventory Report", _
strDirectory & strFileName, True
strFileName = Dir()
Loop
End Sub
Can my request be done, and if so can someone point me in the right
direction? Please bear in mind I am still a novice when it comes to
VBA, but I am trying to learn as much as possible.
Any information that can be provided would be greatly appreciated.