Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need help with the following code. I would like to ping an IP Address
(x.x.x.x) that is referenced to cell A1 in Sheet1. Any help is appreciated. Sub Ping() Sheets.Add Shell ("cmd /c ping -n 10 -l 1024 x.x.x.x c:\ping.txt") Application.Wait Now + TimeSerial(0, 0, 15) End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there.
First, just wondering why you have code for Sheets. Add every time yo call the Ping() function. Seems kind of unnessesary to me. As for getting a Ping function to ping the IP address in Sheet1.A1 that I can do. Sub Ping() Shell ("cmd /c ping -n 10 -l 1024 " & [Sheet1!A1] & " c:\ping.txt") Application.Wait Now + TimeSerial(0, 0, 15) End Sub I took the liberty of removing the Sheet.Add, but feel free to put i back in if you need it. This does work, just tested it, and it write the results of the A1 ping in C:\ping.txt Hope that helps. -Bo -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I don't know if your ping command is correct, but this is the basic
VBA code (untested) :- '---------------------------------------------------- Sub Ping() Dim IPaddress As String Dim CommandStr As String '-------------------------- IPaddress = Worksheets("Sheet1").Range("A1").Value CommandStr = "PING " & IPaddress & "~" rsp = Shell("cmd", 1) SendKeys CommandStr, True End Sub '-------------------------------------------------- (JStone0218) wrote in message ... I need help with the following code. I would like to ping an IP Address (x.x.x.x) that is referenced to cell A1 in Sheet1. Any help is appreciated. Sub Ping() Sheets.Add Shell ("cmd /c ping -n 10 -l 1024 x.x.x.x c:\ping.txt") Application.Wait Now + TimeSerial(0, 0, 15) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Modifying Networkdays | Excel Discussion (Misc queries) | |||
Modifying A Formula | Excel Worksheet Functions | |||
help Modifying | Excel Worksheet Functions | |||
Help modifying code | Excel Programming | |||
Modifying Code that deletes a Row | Excel Programming |