Gruppe
Allgemein
Problem
Wie kann ich für eine Gruppe von Verbrauchern die monatliche Wassergeldabrechnung ohne VBA-Einsatz automatisieren?
StandardModule: Modul1
Sub TestFileOpen()
Dim iOpen As Integer
Dim sFile As String
sFile = InputBox("Path and Filename:", , "c:\test\test.xls")
If sFile = "" Then Exit Sub
Do While TestOpen(sFile) = 1
Loop
Workbooks.Open sFile
End Sub
Private Function TestOpen(sPath As String) As Integer
If Dir(sPath) = "" Then
TestOpen = 2
Else
On Error GoTo ERRORHANDLER
Open sPath For Random Access Read Lock Read Write As #1
Close #1
End If
ERRORHANDLER:
If Err = 70 Then TestOpen = 1
End Function