1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Ping in Excel and want to add DNS lookup

Discussion in 'Software Development' started by vineet9singh, Jun 25, 2018.

Thread Status:
Not open for further replies.
  1. vineet9singh

    vineet9singh Thread Starter

    Joined:
    Jun 25, 2018
    Messages:
    1
    Dear Sir,

    I want to add one more column for DNS lookup in below mention code:

    Sub ClearValues()
    'ResetValues
    Rows("4:5124").Select
    Selection.ClearContents
    Rows("4:4").Select
    End Sub
    Sub RunPing()
    i = 4
    While (ActiveSheet.Cells(i, 1) <> "")
    'Retrieve IP Address
    strCompAddress = ActiveSheet.Cells(i, 1)

    '//Setup Shell command for Ping
    '//NOTE: Make to leave a space after PING.exe
    Dim strShellCommand As String
    strShellCommand = "C:\Windows\System32\PING.exe " + strCompAddress

    '//Create Shell Object in to run Scripts
    Set oSh = CreateObject("WScript.Shell")
    Set oEx = oSh.Exec(strShellCommand)

    '//Read output buffer
    strBuf = oEx.StdOut.ReadAll
    ActiveSheet.Cells(i, 2) = strBuf
    i = i + 1
    Wend
    End Sub
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1211990

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice