PDA

View Full Version : Solved: File name in status bar



khalid79m
10-24-2008, 08:06 AM
How can I display the file name in the status bar

I can display NOW() in the status bar how can I display the file name??

can it be done

Any help:banghead:

CCkfm2000
10-24-2008, 08:16 AM
try this....

Sub Display_Filename_on_Status_Bar()
Sheets("sheet1").Select
Dim p As String, x As Variant
p = "c:\search folder\*.xls" <- edit this to the folder you want
x = GetFileList(p)
Application.StatusBar = x

End Sub ' Function
Function GetFileList(FileSpec As String) As Variant
' Returns an array of filenames that match FileSpec
' If no matching files are found, it returns False
Dim FileArray() As Variant
Dim FileCount As Integer
Dim FileName As String

On Error GoTo NoFilesFound
FileCount = 0
FileName = Dir(FileSpec)
If FileName = "" Then GoTo NoFilesFound

' Loop until no more matching files are found
Do While FileName <> ""
FileCount = FileCount + 1
ReDim Preserve FileArray(1 To FileCount)
FileArray(FileCount) = FileName
FileName = Dir()
Loop
GetFileList = FileArray
Exit Function
' Error handler
NoFilesFound:
GetFileList = False
End Function

mdmackillop
10-24-2008, 08:19 AM
Sub Status()
oldStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.StatusBar = ActiveWorkbook.Name
tim = Timer
Do
DoEvents
Loop Until Timer - tim > 10
Application.StatusBar = False
Application.DisplayStatusBar = oldStatusBar
End Sub

khalid79m
10-24-2008, 08:55 AM
thanks your a superstar