Solved

This question is for aikimark only, thanks!

Posted on 2002-04-02
5
166 Views
Last Modified: 2010-05-02
aikimark,

I tired Shell("tracert " & strmachinename & " > " & App.Path & "\paths.lst"), it didn't work.

Dim MachineName As String
Dim ReturnCode As Integer
MachineName = "gluon"
ReturnCode = Shell("tracert " & MachineName & " > " & "c:\vbwork\traceroute\tracert.txt")

It did not write anything to the file.  "gluon" is a working machine, I could tracert it under DOS.

Thanks,
hxia


0
Comment
Question by:hxia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 6913932
I saw your previous message on this, so I'll help out.

On Windows, certain "DOS" commands require a prefix command to "jumpstart them.  The two choices are "start" and "cmd".  Try something like this:

ReturnCode = Shell("cmd /c tracert " & MachineName & " > " & "c:\vbwork\traceroute\tracert.txt")

For Win95/98/ME systems, replace cmd with command.  FYI, the /c will close the DOS window when the command completes.  Also, this may not work on XP without a special plug-in (or so I've heard.)
0
 

Author Comment

by:hxia
ID: 6914049
Hi rspahitz,

Thanks!  Actually, I was able to tracert just using that coding, but could not write to the file.  If i just do this, Shell("tracert " & MachineName), it'll work, and I can see the output on the console.

I tried with cmd, still couldn't write to a file.

hxia
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 50 total points
ID: 6914098
I had problems with the original, but on my Win2000 machine, this worked (althogh delayed because the trace took a while):

  Shell ("cmd /c tracert www.microsoft.com > " & "c:\tracert.txt")

Make sure that you have a valid result path.
Also make sure that you wait until the DOS window (launched by Shell) completes before looking for the file.
0
 

Author Comment

by:hxia
ID: 6914170
Yep, it worked.  Thanks!
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6914260
Glad to help.  I hope aikmark won't get upset ;)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month3 days, 11 hours left to enroll

630 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