How do I open a Command Prompt Window in vba and include a a command to execute like a ping command

 I have a form in Access and I want to open a Windows Command window.  I created a command button to open this window as follows:

Private Sub cmdShowCommandWindow_Click()
     Dim MyAppId As Double
     MyAppId = Shell("", 1)

End Sub

  I would like to have the window load a string into the command line.

   For example:  
    Dim xstr as string
    xstr = ping mycomputer
    I want this string to show up in the command window when it opens  and then execute it leaving the command windo open to show the ping command replying.

    >   Ping mycomputer


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shell Environ("COMSPEC") & " /k ping", vbNormalFocus

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alternatively, you could ping from your program:
How to Ping an IP Address Using Visual Basic
you can write a batch file with the content

ping mycomputer

and then shell the batch file

to write a batch file just open notepad and type in the command line text
then save the file as something.bat where something is what you choose to name it

hope this helps
bulrickAuthor Commented:
Thank you! just what I wanted.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.