 |

07-01-2004, 01:02 PM
|
 |
Regular
|
|
Join Date: Dec 2003
Posts: 93
|
|
CopyFile...
|
Code:
CopyFile CommonDialog1.filename, App.Path & "\temp\", True
Whats wrong with this code? I need to copy the file in the commondialog to the app.path\temp folder, but I need to keep the same name as the file as in the commondialog.filename.
Is there a way to copy a file to a folder without specifying the filename, just using the same filename instead?
Having a brain freeze here... 
|
|

07-01-2004, 01:04 PM
|
 |
Junior Contributor
|
|
Join Date: Mar 2004
Location: Manila, PHIL
Posts: 294
|
|
Quote:
|
Originally Posted by Justin-Credible
Code:
[B]CopyFile[/B] CommonDialog1.filename, App.Path & "\temp\", True
|
Did you mean FileCopy?
|
|

07-01-2004, 01:31 PM
|
 |
Keeper of foo
Retired Moderator * Guru *
|
|
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
|
|
|
CopyFile is a Windows API and would have to be declared. If you're trying to use the native VB function, it's as Jigo said.
|
__________________
~ Quod non mortiferum, fortiorem me facit ~
Avatar by lebb
|

07-01-2004, 04:53 PM
|
|
Contributor
|
|
Join Date: Mar 2002
Location: Essex, UK
Posts: 690
|
|
I *think* VB is getting confused and thinks you want to copy a file as a directory, instead of into one...
Add the filename to the directory, for example:
Code:
CopyFile "c:\test\myfile.ext", App.Path & "\temp\myfile.ext", True
From a full filename, its not too hard to break it up and work out what just the file is called.
I've a funny feeling thats whats going on though...
So, some sample code...
Code:
ls_fullFilename = commondialog1.filename
ls_file = Right$(ls_fullFilename, InStrRev(ls_fullFilename, "\"))
CopyFile CommonDialog1.filename, App.Path & "\temp\" & ls_file, True
|
Last edited by Chris J Locke; 07-01-2004 at 04:58 PM.
|

07-01-2004, 05:55 PM
|
 |
Regular
|
|
Join Date: Dec 2003
Posts: 93
|
|
|
Thanks guys. Chris' example is what I'm going for; a way to find the file name (just the filename, not the entire path) from the CommonDialog.FileName.
I've been messing with the sample code, but I haven't gotten it to work...
|
|

07-01-2004, 05:58 PM
|
 |
Regular
|
|
Join Date: Dec 2003
Posts: 93
|
|
|
Got it. Did a search on the forum and found the FileTitle property of CommonDialog returns the filename without the path.
Thanks for the help!
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|