gelöst hab ichs dann ohne scripting so:
danke für die Anteilnahme!
Mischa Richter
Option Explicit
Private UsrFree As String * 8
Private TotSize As String * 8
Private TotFree As String * 8
Private Const LW = "x:"
Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" _
Alias "GetDiskFreeSpaceExA" (ByVal lpPathname As _
String, ByVal UserFree As Any, ByVal TotalSize As _
Any, ByVal TotalFree As Any) As Long
Sub auto_open()
Call start
ThisWorkbook.Save
'Beenden, bei automatischem Start:
If Hour(Time)
Application.Quit
Else
MsgBox "Messung gespeichert", vbExclamation, "Messung für Laufwerk: " & LW
End If
End Sub
Public Sub start()
Call GetFreeDiskSpace(LW)
Dim msg As String
msg = "Speicher auf " & LW & vbCrLf & _
"Insgesamt: " & TotSize & vbCrLf & _
"Belegbar : " & TotFree & vbCrLf & _
"Frei : " & UsrFree
'MsgBox msg, vbExclamation, "Speicherplatz auf " & LW
ThisWorkbook.Worksheets("GB frei auf sok-003").Select
Range("a1").Activate
Selection.End(xlDown).Select
ActiveCell.Offset(1).Activate
ActiveCell.Value = Date
ActiveCell.Offset(0, 1).Activate
ActiveCell.Value = CLng(UsrFree) / 107500 'pauschale Annäherung
ActiveCell.Offset(0, 1).Activate
ActiveCell.Value = Time
End Sub
Private Function GetFreeDiskSpace(ByVal LW) As Double
Call GetDiskFreeSpaceEx(LW, UsrFree, TotSize, TotFree)
UsrFree = Format$(CvStr(UsrFree), "##,###,###,###")
TotSize = Format$(CvStr(TotSize), "##,###,###,###")
TotFree = Format$(CvStr(TotFree), "##,###,###,###")
End Function
Function CvStr(s) As Double
Dim i%, x As Double, p As Double
p = 1
For i = 1 To Len(s)
x = x + Asc(Mid(s, i, 1)) * p
p = p * 256
Next i
CvStr = x
End Function