Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Shell command

Posted on 2007-03-21
8
Medium Priority
?
284 Views
Last Modified: 2010-04-30
Hi: Can any one please tell me how to i use the shell command to copy file from one location to another. I try to copy from vpath2 into strdestination and it create a file but its blank

ShellExecute 0, vbNullString, Chr(34) & vPath & vFile & Chr(34), vbNullString, vbNullString, vbMaximizedFocus

Option Explicit
Public Declare Function ShellExecute Lib "shell32.dll" _
   Alias "ShellExecuteA" (ByVal HWnd As Long, ByVal lpOperation As String, _
   ByVal lpFile As String, ByVal lpParameters As String, _
   ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
0
Comment
Question by:mustish1
[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
  • 4
  • 2
  • 2
8 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18763942
why do you not use the FileCopy command?

anyhow, what is the value of vPath and vFile? maybe you do not call the ShellExecute properly?
0
 

Author Comment

by:mustish1
ID: 18764023
vpath=inputpath.text
vfile=outputpath.text

vpath-->C:\Documents and Settings\khamu443\My Documents\temp20070321-100914.xls
vfile-->C:\REMITandNSF\New_Import_PCDI03_032107.txt

Thanks.
0
 

Author Comment

by:mustish1
ID: 18764025
OOPS I am sorry
vpath-->C:\Documents and Settings\khamu443\My Documents\temp20070321-100914.txt
0
Independent Software Vendors: 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!

 
LVL 20

Expert Comment

by:hes
ID: 18764055
If this is the case here is your statement
ShellExecute 0, vbNullString,  "C:\Documents and Settings\khamu443\My Documents\temp20070321-100914.txtC:\REMITandNSF\New_Import_PCDI03_032107.txt" ,vbNullString, vbNullString, vbMaximizedFocus

You arent trying to execute anything and
Chr(34) & vPath & vFile & Chr(34), is all togeather

0
 
LVL 20

Expert Comment

by:hes
ID: 18764064
as angel stated why not just use VB's native FileCopy

FileCopy(vpath,vfile)
0
 

Author Comment

by:mustish1
ID: 18764106
ok thanks. But if you please tell me how to i copy from vpath into vfile thru shellexecute command
0
 

Author Comment

by:mustish1
ID: 18764132
I try to use the variable names but it gives syntax error.
ShellExecute 0, vbNullString, vpath2 strDestination, vbNullString, vbNullString, vbMaximizedFocus
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 18764155
>ok thanks. But if you please tell me how to i copy from vpath into vfile thru shellexecute command
please try this:
ShellExecute 0, vbNullString, "cmd /c copy """ & vPath & """ """& vFile & """ ", vbNullString, vbNullString, vbMaximizedFocus
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

688 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