Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture all .doc files from directory 2

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
This might be the wrong forum although the acticex forum looks quiet.

I have an Access form on which there is a common dialogue control. I am trying to fill a list, eventually a table, with all the paths/documents names (.doc) from a selected directory. At the moment I can get one at a time, but its taking a long time to fill a list. Can the code be modified in any way, or anyone got other ideas. Many thanks

Private Sub Command5_Click()
Dim strFilter As String
Dim strInputFileName As String

'strFilter = ahtAddFilterItem(strFilter, "JPEG Files (*.jpg, *.jpeg)", "*.jpg;*.jpeg")
strFilter = ahtAddFilterItem(strFilter, "doc Files (*.doc)", "*.doc")
' strFilter = ahtAddFilterItem(strFilter, "all Files (*.*)", "*.*")

strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, _
OpenFile:=True, _
DialogTitle:="Choose a Transcription file...", _
Flags:=ahtOFN_HIDEREADONLY)

If Len(strInputFileName) > 0 Then
'MsgBox "You have just selected this Path: " & strInputFileName
Me.STOREDPATH.AddItem strInputFileName
Me.Command5.SetFocus
Command5_Click
Else
'No file chosen, or user canceled
End If

End Sub
 
Use the Lebans code to select 'third' (it will appear here: fs.getFolder('Third')) and my example to get 'cricket\something.doc' etc.
 
Sorry for being stupid, but I do not know which is the Lebans code.

I have tried this

DDS = "K:\ESPNCSC\PRODUCTION\ITWS TRANSCRIPTIONS"
DDP = "ITWS TRANSCRIPTIONS"


Set fs = CreateObject("Scripting.FileSystemObject")
Set fol = fs.getFolder(DDP)

For Each sfol In fol.SubFolders

For Each fil In sfol.files
If fil.Type = "Microsoft Word Document" Then
Me.gb.AddItem fil.Name
End If
Next
Next

I don't know why but the real Third directory has a spacein its name, so I tried putting in quotes, in a variable, and with a _ between but nothing happens apart from it saying it cannot find the path if just getting the third directory being put in here fs.getFolder('Third'))
 
That would be:

Set fol = fs.getFolder(DD[red]S[/red])

We were talking about Leban's code on 27 Nov 07 16:43.
 
Thanks Remou. I imported the form/module again of the Lebans example. I played around with it, but it opens a browser which I am trying to get away from, so I have resorted back to looping lists which all works with your good help, so thanks, I'm well satisfied. Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top