Hide Command Shell window

C

Corey

Hi Folks,

I'm trying to use the following VBA code to verify a list of server's DNS
record. Although the results are correct, the command shell window always
appears. Is any way to completely hide it? TIA.

Corey

Code:

Function MyNslookupExe(ByRef fstrFQDN As String, ByRef fstrRealIP As String,
fstrCmd As String)

' The function is to receive nslookup result.

Dim WSH, wExec
Dim Result As String
Dim tmp

fstrFQDN = ""
fstrRealIP = ""

Set WSH = CreateObject("WScript.Shell")
Set wExec = WSH.Exec(fstrCmd)

Result = wExec.StdOut.ReadAll

tmp = Split(Result, vbCrLf)

If tmp(3) <> "" And Left(tmp(3), 4) = strName Then

fstrFQDN = LCase(Trim(Right(tmp(3), Len(tmp(3)) - Len(strName) - 1)))
fstrRealIP = LCase(Trim(Right(tmp(4), Len(tmp(4)) - Len(strAddress)
- 1)))

End If

Set wExec = Nothing
Set WSH = Nothing

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top