i want to copy a file from fixed location like
d:\my project\abc.txt
to the folder user select like
e:\backup\abc.txt
now what is the code to copy and what is the code to paste files
if any body know some sample project as just there are many sample/snippert
availeable in this site please tell me i had searched a lot but get nothing useful .
have no idea about how to write these codes
thanks
How to copy/paste files
Page 1 of 15 Replies - 22604 Views - Last Post: 27 July 2009 - 10:42 PM
Replies To: How to copy/paste files
#2
Re: How to copy/paste files
Posted 22 March 2008 - 09:42 AM
You're going to want to use the FileSystemObject in VB6 for copying files.
#3
Re: How to copy/paste files
Posted 22 March 2008 - 11:39 AM
did i had to add some reference in my project
becasue if i write
just as i cross "as" it
has to show me filesystemobject automatically but n
not showing it at all as shown if fig1

similary if i write fso. it has to show me the functions
it has to perfom but showing nothing see pic

so what wrong with it
becasue if i write
Quote
dim fso as filesystemobject
just as i cross "as" it
has to show me filesystemobject automatically but n
not showing it at all as shown if fig1

similary if i write fso. it has to show me the functions
it has to perfom but showing nothing see pic

so what wrong with it
PsychoCoder, on 22 Mar, 2008 - 09:42 AM, said:
You're going to want to use the FileSystemObject in VB6 for copying files.
#4
Re: How to copy/paste files
Posted 22 March 2008 - 11:49 AM
Yeah you have to add the Microsoft Scripting Runtime reference.
Go to Project >> References... >> Microsoft Scripting Runtime and check the box next to it.
Then you should be able to use the FileSystemObject.
Enjoy!
Go to Project >> References... >> Microsoft Scripting Runtime and check the box next to it.
Then you should be able to use the FileSystemObject.
Enjoy!
#5
Re: How to copy/paste files
Posted 22 March 2008 - 11:38 PM
i want to copy a specific file and paste into another folder
i am using the following code
when i run this code i get errror
"argument not optional "
what chages i have to made in it
any help
i also want to copy more than one files and it should be pasted with
out promting that file already exists
i am using the following code
Quote
'' getting the required file to be copied
fso.GetFile "D:\Data\smeb_Data.MDF"
'' creating newfolder
If fso.FolderExists("H:\Backup") Then
Else
fso.CreateFolder "H:\Backup"
End If
''pasting the file
fso.CopyFile "H:\Backup\smeb_Data.MDF"
Exit Sub
fso.GetFile "D:\Data\smeb_Data.MDF"
'' creating newfolder
If fso.FolderExists("H:\Backup") Then
Else
fso.CreateFolder "H:\Backup"
End If
''pasting the file
fso.CopyFile "H:\Backup\smeb_Data.MDF"
Exit Sub
when i run this code i get errror
"argument not optional "
what chages i have to made in it
any help
i also want to copy more than one files and it should be pasted with
out promting that file already exists
#6
Re: How to copy/paste files
Posted 27 July 2009 - 10:42 PM
'' getting the required file to be copied
fso.GetFile "D:\Data\smeb_Data.MDF"
'' creating newfolder
If fso.FolderExists("H:\Backup") Then
Else
fso.CreateFolder "H:\Backup"
End If
''pasting the file
'Syntax
'fso.CopyFile OriginalFilePath,Pasting File Path
fso.CopyFile "D:\Data\smeb_Data.MDF", "H:\Backup\smeb_Data.MDF"
Exit Sub
Note :
When you pasting your copied file you should notify copied file path and pasting file path.
** Edit **
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|