LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Ping via VBA

Hi

Is it possible to ping a range of local IP addresses in VBA code by looping
through the range using variables to produce a text file which includes the
results?

The range I want to ping is 192.168.0.0 to 192.168.255.255

I can create the nested loop command structure to increment the variables
but can't pass them to the ping command.

Extract of the code:

Option Explicit
Dim a,b,c,d,y,z
For y = 0 To 255
For z = 0 To 255
Let a = 192
Let b = 0
Let c = y
Let d = z
Shell ("cmd /c ping a.b.c.d c:\ping.txt")
Next z
Next y

This results in the following message being pasted to ping.txt:

"Ping request could not find host a.b.c.d. Please check the name and try
again" from which I assume the contents of the variables are not being
passed into the shell command.

Assuming the variables can be passed to the ping command, is it then
possible to append the results of each loop to the text file instead of over
writing it's contents?

The reason I want to do this is that I have a printer with a NIC that I want
to connect to my router and I think the printer has a fixed IP address but I
can't communicate with it and don't want to spend eternity manually pinging
all the addresses in the range until I hit the right one! Unfortunately I
don't have the manual for the NIC and the Kyocera website isn't much help
(not even sure the NIC card is a Kyocera).

Any suggestions appreciated.

Thanks

Garry Douglas


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ping a Set of IPs [email protected] Excel Programming 1 August 30th 06 06:01 PM
Ping from Excel - Almost there RRohl Excel Programming 3 August 22nd 06 07:26 AM
PING Bob Phillips Steve Excel Discussion (Misc queries) 3 July 4th 05 07:31 PM
ping in excel Andy Mohan Excel Programming 5 February 21st 05 10:08 PM
Ping anybody Laphan[_2_] Excel Programming 4 November 28th 03 02:51 AM


All times are GMT +1. The time now is 10:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"