Code:
Option Explicit
Sub Macro1()
    Dim strDestFile As String
    Dim iFileNum As Integer
    
    strDestFile = "c:\JUNK.txt"
    
    'This is one thing you are missing
    iFileNum = FreeFile
    
    Open strDestFile For Output As #iFileNum
    ' If an error occurs report it and end.
    If Err <> 0 Then
        MsgBox "Cannot open filename " & strDestFile
        End
    'This is one thing you are missing!
    End If
    
    'write " HELLO WORLD"
    Write #iFileNum, "HELLO WORLD"

    Close #iFileNum
End Sub