AW: Countdown in einer Form
10.07.2025 14:17:43
schauan
Hallöchen,
wenn Du das außerhalb von Excel anlegst, kannst Du in Excel machen was Du willst ;-) Den code z.B. als CountDown.vbs speichern und in Excel aufrufen.
Mit top und left musst Du schauen,
Makro:
Sub CountDown()
Const strPath$ = "C:\Test\CountDown.vbs"
Dim strShell$
strShell = "wscript.exe """ & strPath & """"
Shell strShell, vbNormalFocus
End Sub
CountDown.vbs:
Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.navigate("about:blank")
.Document.Title = "Countdown" & string(100, chrb(160))
.resizable=0
.height=200
.width=100
.top = 150
.left = 350
.menubar=0
.toolbar=0
.statusBar=0
.visible=1
End With
Do while oIE.Busy
wscript.sleep 500
Loop
oIE.document.body.innerHTML = ""
for i=10 to 0 step -1
oIE.document.all.countdown.innerText= i
wscript.sleep 1000
next
oIE.quit
Mal etwas abgewandelt mit Positon und Zeit als Arumente und nervig im Vordergrund :-)
Makro:
Sub CountDownArgs()
Const strPath$ = "C:\Test\CountDown2.vbs"
Dim strShell$, strArg1$, strArg2$, strArg3$
'Top, Left und Zeit fuer Counter
'Reihenfolge ergibt sich aus Reihenfolge im Script!
strArg1 = 300: strArg2 = 500: strArg3 = 5
strShell = "wscript.exe """ & strPath & """ """ & strArg1 & """ """ & strArg2 & """ """ & strArg3 & """"
Shell strShell, vbNormalFocus
End Sub
CountDown2.vbs
Set oIE = CreateObject("InternetExplorer.Application")
Dim strTop, strLeft, strTime
strTop = WScript.Arguments(0)
strLeft = WScript.Arguments(1)
strTime = WScript.Arguments(2)
With oIE
.navigate("about:blank")
.Document.Title = "Countdown" & string(100, chrb(160))
.resizable=0
.height=200
.width=100
.top = strTop
.left = strLeft
.menubar=0
.toolbar=0
.statusBar=0
.visible=0
.visible=1
End With
Do while oIE.Busy
wscript.sleep 500
Loop
oIE.document.body.innerHTML = ""
for i=strTime to 0 step -1
With oIE
.document.all.countdown.innerText= i
.visible=0
.visible=1
wscript.sleep 1000
End With
next
oIE.quit