' Reloading workbook itself with delay by the aid of WScript.Sleep
Sub ReloadExcel()
Const Seconds = 10 ' <- delay in seconds
Dim xlFileName$, vbsFileName$, vbsText$, FileNo%, Wb
' Define reloading file
xlFileName = ThisWorkbook.FullName
vbsFileName = Replace(LCase(xlFileName), ".xls", ".vbs")
' Build the text of VB script
vbsText = "WScript.Sleep(" & Seconds * 1000 & ")" & vbLf _
& "With CreateObject(""Excel.Application"")" & vbLf _
& ".Visible = True" & vbLf _
& ".Workbooks.Open (""" & xlFileName & """)" & vbLf _
& ".Application.Run ""MyMacro""" & vbLf _
& "End With"
' Create VBS file
On Error Resume Next
Kill vbsFileName
FileNo = FreeFile
Open vbsFileName For Binary Access Write As #FileNo
Put #FileNo, , vbsText
Close #FileNo
' Run VB script file
Shell "wscript //e:vbscript """ & vbsFileName & """"
MsgBox "Excel has to be put down...", vbCritical, "Microsoft has caused an Error"
' Close all workbooks and quit
'For Each Wb In Application.Workbooks: Wb.Close: Next
Application.Quit
End Sub
' Macro for calling from VBS
Sub MyMacro()
Dim r As Integer
r = 1
Cells(1, 1).Value = "Here we go this is freaky huh"
n = vbNewLine
words = "Ok so now I have taken over your computer and I am actually digging deep into the " & _
"system files to get your detials..."
Do Until Len(words) = Len(swords)
swords = Left(words, r)
Cells(2, 1).Value = swords
c = 1
Do Until c = 500000
c = c + 1
Loop
r = r + 1
Loop
c = 1
Do Until c = 15000000
c = c + 1
Loop
MsgBox "Acquired log on details for " & Application.UserName & "!" & n & _
n & "Password acquired also..."
words = "Almost done"
r = 1
Do Until Len(words) = Len(swords)
swords = Left(words, r)
Cells(3, 1).Value = swords
c = 1
Do Until c = 400000
c = c + 1
Loop
r = r + 1
Loop
c = 1
Do Until c = 15000000
c = c + 1
Loop
words = "OK! got it"
r = 1
Do Until Len(words) = Len(swords)
swords = Left(words, r)
Cells(4, 1).Value = swords
c = 1
Do Until c = 300000
c = c + 1
Loop
r = r + 1
Loop
c = 1
Do Until c = 15000000
c = c + 1
Loop
MsgBox "Just kidding penut don't panic. Its a joke, can't get your details like that anyway"
Cells.Clear
Cells(1, 1).Value = "Click on the running man to see him run..."
End Sub