View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jurgenC! jurgenC! is offline
external usenet poster
 
Posts: 4
Default list Workbooks in Current Folder

Hi Wolf,

thanks for your solution and especially the sorting routine.

find following the code which i use now for my Worksheet:

Sub listProjectFiles()
Dim myFile As String
Dim i As Integer
myFile = Dir(ActiveWorkbook.Path & "\*.xls")
i = 1
Do While myFile < ""
If myFile < ActiveWorkbook.Name Then
If myFile Like "TestCas*(*" Then
Range("TestCasesOverview").Offset(i, 0) = myFile
i = i + 1
End If
End If
myFile = Dir
Loop
End Sub

this works like a charm, if for example the folder has follwoing XLS
files:
TestPlan
TestCases (test)
TestCases template
and i execute (from TestPlan the mastersheet), i receive following list:
TestCases (test)

- i am somewhat perplexed though when trying to shorten the above code
to following:

Sub listProjectFiles()
Dim myFile As String
Dim i As Integer
myFile = Dir(ActiveWorkbook.Path & "\*.xls")
i = 1
Do While myFile < ""
If myFile < ActiveWorkbook.Name or myFile < "*template" Then
Range("TestCasesOverview").Offset(i, 0) = myFile
i = i + 1
End If
myFile = Dir
Loop
End Sub

i then receive following list:
TestCases (test)
TestCases template

however, i am trying to omit 'TestCases template'

it is not a major concern but would be great to understand where my
logic is taking a wrong turn

cheers....

....jurgenC!

remove "somewhere" from eMail when replying direct

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!