Solved

This question is for aikimark only, thanks!

Posted on 2002-04-02
5
159 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now