ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problems with reading files (https://www.excelbanter.com/excel-programming/303683-problems-reading-files.html)

Philipp Oberleitner[_2_]

Problems with reading files
 
Hmm i wrote a makro that should search the newest .xls file in a directory
and open it. But it alway brings errors and no file gets opened. Can anyone
help me ?

Public ZMappe As String

Sub Auto_Open()

Dim Dat As Date
Dim DatVgl As Date
Dim Mappe As String

Const s = _
"F:\Siemens"
Mappe = Dir(s & "\*.xls")
Dat = FileDateTime(s & "\" & Mappe)

Do Until Mappe = ""
DatVgl = FileDateTime(s & "\" & Mappe)
If DatVgl Dat Then
Dat = DatVgl
ZMappe = s & "\" & Mappe
End If
Mappe = Dir()
Loop

Workbooks.Open Filename:=ZMappe



End Sub

Thanks alot in advance




All times are GMT +1. The time now is 04:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com