AW: Wert der Verknüpfung für Variable
Veit
'ziel ist es im Netzwerk an bestimmte Rechnergruppen Bildschirmnachrichten zu senden.
'und hier der Code:
Sub Dateienauslesen()
Dim arr As Variant
Dim iCounter As Integer, iRow As Integer, iAct As Integer
Dim sPath As String, sFormula As String, sTmp As String, übergabe As String, hostname As String
nachricht = "Das ist ein Test"
sPath = "c:\test\"
arr = "Computerübersicht.xls"
sFormula = "='"
sFormula = sFormula & sPath & "["
sFormula = sFormula & arr & "]"
sFormula = sFormula & "Dresden'!"
sTmp = Right(sFormula, Len(sFormula) - 1)
For i = 2 To 4
sFormula = sFormula & "B" & i
'Cells(i, 1).Formula = sFormula
hostname = sFormula 'und hier hätte ich gerne den Hostnamen also den Inhalt der Zelle und nicht den Pfad zu der Zelle
Shell ("net send " & hostname & " " & nachricht)
sFormula = Left(sFormula, Len(sFormula) - 2)
Next i
End Sub
Function FileArray(sPath As String, sPattern As String)
Dim arr()
Dim iCounter As Integer
Dim sFile As String
If Right(sPath, 1) <> "\" Then sPath = sPath & "\"
sFile = Dir(sPath & sPattern)
Do While sFile <> ""
iCounter = iCounter + 1
ReDim Preserve arr(1 To iCounter)
arr(iCounter) = sFile
sFile = Dir()
Loop
FileArray = arr
End Function