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
Solved

Get result

Posted on 2006-11-07
4
181 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
  • 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

789 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