Solved

compying text file

Posted on 2002-03-29
5
186 Views
Last Modified: 2013-11-13
hi all i am wondring how can i protect my project when it played from the CD
i want to check up on the c:\ about text file named hossam that is exist on the cd when it cant be found on c:\ then i want to copy this file to the c:\ using my exe project & when i found the txt file on the c:\ so i can unload the form of my project
my question is how can i copy this file from the carent drive to the c:\ drive & how can i check it up
best regards
hossam
0
Comment
Question by:hmahfouzy
  • 3
5 Comments
 
LVL 3

Expert Comment

by:Bahnass
ID: 6906148
about filecopy

filecopy "D:\hossam",c:\Hossam"

but what do u mean about protection ??
Eng. Ibraheem
0
 

Accepted Solution

by:
talluri_28 earned 200 total points
ID: 6906473
hi hossam,

i am giving Code. i think it is use full to u.

Dim fso As New FileSystemObject

Public Sub Check_file()
 
   If (fso.FileExists("C:\hossam.txt")) = False then
       fso.CopyFile "c:\hossam.txt", "C:\hossam.txt"
   else
     'Unload Me 'Unload the form
     End 'Close the Application
   endif

End Sub


0
 

Expert Comment

by:talluri_28
ID: 6906483
hi

u have to give the reference "SCRRUN.DLL" 'Microsoft Scripting Control'

jag
0
 
LVL 1

Author Comment

by:hmahfouzy
ID: 6906915
may please explain where can i put this code in the declaration or else ?
thanx
0
 

Expert Comment

by:talluri_28
ID: 6909666
Hi

If u want to use fso oject entire form u can declare in Declatation, other wise u can declare where u r using particular procedure

sorry previously i was written like this

fso.CopyFile "c:\hossam.txt", "C:\hossam.txt"

please modify that to

fso.CopyFile "D:\hossam.txt", "C:\hossam.txt"

tnx

jag


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now