Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

HOW TO RUN OTHER APPLICATIONS OR BACK_UP BATCH FILE FROM EXCEL

  Asked By: Meenachi    Date: Aug 24    Category: MS Office    Views: 645
  

I have made one simple Macro Button1_click in which I have written

Sub Button1_Click()
XCOPY C:\Tally\*.* D:\Tally
End Sub

Kindly help me out as none Copy or Xcopy command
shows error, is there any way

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Ivan Coleman     Answered On: Aug 24

You just need to make a small change to your program.
Instead of writing just XCOPY C:\......

you write
shell ("XCOPY C:\Tally\*.* D:\Tally\)

 
Answer #2    Answered By: Jet Brown     Answered On: Aug 24

You really should consider using the VBA version of this.
It runs faster, and it allows for error  handling (if necessary).

try:
Sub Button1_Click()
dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.copyfile "C:\Tally\*.*", "D:\Tally\", True
End Sub

 




Tagged: