?
Solved

This question is for aikimark only, thanks!

Posted on 2002-04-02
5
Medium Priority
?
167 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 200 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

719 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