Hi,
if you want to use FileOpen dialog to select files - you can use this API:
http://www.mvps.org/access/api/api0001.htm
make sure to use this flag - ahtOFN_ALLOWMULTISELECT
But my idea was to use Dir() function to add files to listbox, look in
access help for sample code to get all files from directory
--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.nethttp://www.PointLtd.com
Thanks.
How do I build the form to make my file selections?
I have spent hours on MSDN looking at the following:
FileDialog.Show Method
Office Developer Reference
Displays a file dialog box and returns a Long indicating whether the
user pressed the Action button (-1) or the Cancel button (0). When you
call the Show method, no more code executes until the user dismisses
the file dialog box. In the case of Open and SaveAs dialog boxes, use
the Execute method right after the Show method to carry out the user's
action.
Syntax
expression.Show
expression Required. A variable that represents a FileDialog
object.
Example
The following example displays a File Picker dialog box using the
FileDialog object and displays each selected file in a message box.
Visual Basic for Applications
Sub Main()
'Declare a variable as a FileDialog object.
Dim fd As FileDialog
'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'Declare a variable to contain the path
'of each selected item. Even though the path is aString,
'the variable must be a Variant because For Each...Next
'routines only work with Variants and Objects.
Dim vrtSelectedItem As Variant
'Use a With...End With block to reference the FileDialog object.
With fd
'Use the Show method to display the File Picker dialog boxand
return the user's action.
'The user pressed the button.
If .Show = -1 Then
'Step through each string in the FileDialogSelectedItems
collection.
For Each vrtSelectedItem In .SelectedItems
'vrtSelectedItem is a string that containsthe path of
each selected item.
'You can use any file I/O functions that you want to
work with this path.
'This example displays the path in a message box.
MsgBox "The path is: " & vrtSelectedItem
Next vrtSelectedItem
'The user pressed Cancel.
Else
End If
End With
'Set the object variable to nothing.
Set fd = Nothing
End Sub
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
OpenFileDialog Class
Prompts the user to open a file. This class cannot be inherited.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
Visual Basic (Declaration)
Public NotInheritable Class OpenFileDialog
Inherits FileDialog
Visual Basic (Usage)
Dim instance As OpenFileDialog
C#
public sealed class OpenFileDialog : FileDialog
C++
public ref class OpenFileDialog sealed : public FileDialog
J#
public final class OpenFileDialog extends FileDialog
JScript
public final class OpenFileDialog extends FileDialog
Remarks
This class allows you to check whether a file exists and to open it.
The ShowReadOnly property determines whether a read-only check box
appears in the dialog box. The ReadOnlyChecked property indicates
whether the read-only check box is checked.
Most of the functionality for this class is found in the FileDialog
class.
If you want to give the user the ability to select a folder instead of
a file, use FolderBrowserDialog instead.
Example
The following code example creates an OpenFileDialog, sets several
properties, and displays the dialog box using the
CommonDialog.ShowDialog method. The example requires a form with a
Button placed on it and the System.IO namespace added to it.
Visual Basic Copy Code
Private Sub button1_Click(sender As Object, e As System.EventArgs)
Dim myStream As Stream
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.InitialDirectory = "c:\"
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|
*.*"
openFileDialog1.FilterIndex = 2
openFileDialog1.RestoreDirectory = True
If openFileDialog1.ShowDialog() = DialogResult.OK Then
myStream = openFileDialog1.OpenFile()
If Not (myStream Is Nothing) Then
' Insert code to read the stream here.
myStream.Close()
End If
End If
End Sub
I cannot get it so users can select multiple files, store those files
in a listbox, and copy the files selected to the local hard drive.
Thank you for your time.
Kevin- Hide quoted text -
- Show quoted text -