I would not use references.
[VBA]Sub IPConfig()
Dim objShell As Object, objExecObject As Object
Dim strLine As String, strIP As String, IPArray() As String, strIPAddress As String

Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("%comspec% /c ipconfig.exe")
Do Until objExecObject.StdOut.AtEndOfStream
strLine = objExecObject.StdOut.ReadLine()
strIP = InStr(strLine, "Address")
If strIP <> 0 Then
IPArray = Split(strLine, ":")
strIPAddress = IPArray(1)
End If
Loop
MsgBox strIPAddress
End Sub[/VBA]

Using WMI:
[VBA]'http://msdn.microsoft.com/en-us/library/windows/desktop/aa394595%28v=vs.85%29.aspx
Sub WMIip()
Dim objWMIService As Object, colItems As Variant, objItem As Object
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"Select IpAddress From Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

For Each objItem In colItems
MsgBox objItem.ipaddress(0)
Exit For
Next objItem
End Sub[/VBA]

You can use this method to append text to a txt file.
[VBA]Function AppendToTXTFile(strFile As String, strData As String) As Boolean
Dim iHandle As Integer
iHandle = FreeFile
Open strFile For Append Access Write As #iHandle
Print #iHandle, strData
Close #iHandle
AppendToTXTFile = True
End Function[/VBA]