Solved

Get result

Posted on 2006-11-07
4
185 Views
Last Modified: 2010-05-03
I am using the following sections of code:

Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile("c:\*.bak")

and

fs.CopyFile "source.dat", "c:\backup.bak"


how can i get results from these commands to check that they have completed successfully or not?
0
Comment
Question by:xizor
[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
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
JackOfPH earned 125 total points
ID: 17895364
Try to use on error...

On error Goto err1:
Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile("c:\*.bak")

msgbox("Delete Successful")
Exit sub

err:
msgbox("delete not successful")
0
 
LVL 15

Expert Comment

by:JackOfPH
ID: 17895373
or

On error Goto err1:

fs.CopyFile "source.dat", "c:\backup.bak"
msgbox("Copy Successful")
Exit sub

err:
msgbox("Copy not successful")
0
 
LVL 2

Author Comment

by:xizor
ID: 17895424
I'm already using an on error for the procedure, i was wondering if there was anyway to get a result from these particular commands.

For example, I am not using force delete opn read only files, so when i made a file read only, it doesn't get deleted, but it doesn't get picked up as an error either.
0
 
LVL 2

Author Comment

by:xizor
ID: 17895506
oh...ignore that....

I dont know why, but when i first tested it i got no error....

then trying some other stuff.. it came back... permission denied...

thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 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