[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Stop Script Box Display During Ping Test

Posted on 2013-06-21
1
Medium Priority
?
362 Views
Last Modified: 2013-06-21
I am using a standard piece of code for a ping test but i would like to do it in the background without displaying the command box - how do i modify the script?

Function SystemOnline(ByVal ComputerName As String)

Dim oShell, oExec As Variant
Dim strText, strCmd As String
 
strText = ""
strCmd = "ping -n 3 -w 1000 " & ComputerName
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
 
Do While Not oExec.StdOut.AtEndOfStream
    strText = oExec.StdOut.ReadLine()
    If InStr(strText, "Reply") > 0 Then
        SystemOnline = True
        Exit Do
    End If
Loop

End Function

Thanks
0
Comment
Question by:SweetingA
1 Comment
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 39267102
I know if you call Shell(), you can add the optional vbHide to hide the window.  Not sure with the Windows scripting shell.

 But there's plenty of ping code floating around like the one here:

http://bytes.com/topic/access/answers/909569-how-ping-smtp-server-vba-ms-access

 Cut and Paste into a new module and you should be set.

Jim.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question