Solved

Copying currently open file

Posted on 1998-09-23
10
147 Views
Last Modified: 2010-04-30
I need to copy my application(which is running, and where this code will be) to another directory.  I know with FileCopy it gives an error if you try to copy an open file(I think) How can I do this?
0
Comment
Question by:bomax
  • 5
  • 3
  • 2
10 Comments
 
LVL 2

Expert Comment

by:AllenC_Jr
ID: 1436320
Use File Copy...
0
 

Author Comment

by:bomax
ID: 1436321
You are very stupid Allan C!!!!!   I said I CAN NOT use filecopy because it gives an ERROR!  Does anyone else know how to?
0
 
LVL 2

Expert Comment

by:AllenC_Jr
ID: 1436322
I Do Not Really Appreciate Being Called Stupid...

I HAVE Used FileCopy, If It doesn't Work For you than to **** Bad...
0
 
LVL 1

Expert Comment

by:toys032498
ID: 1436323
I ELECT THAT WE BAN BOMAX FROM EXPERTS EXCHANGE.  
This sight is for Professionals, not rude people.  We do this for free and we all dont appreciate your unprofessional manner.

PLEASE LEAVE THIS SITE AND DONT EVER RETURN UNTILL YOU APPOLIGIZE TO US ALL!

Anthony
0
 
LVL 2

Expert Comment

by:AllenC_Jr
ID: 1436324
BOMAX If You Are Running the Program In the VB IDE Then IT will error, because it you try to copy the exe from the App.path & App.Exename It Tries to Copy it this way
WhatEverVbIsRunningUnder & App.ExeName

I Have Compiled an Executable that Copies it's self to my C:\ Drive and it doesn't Error, So Don't Do the FileCopy From The IDE, Compile the Program to do this...
0
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.

 

Author Comment

by:bomax
ID: 1436325
Okay, I apologize.  I was very upset when I wrote the comment.  If you could PLEASE provide some code example, AllenC, I would appreciate it very much.  Again, I AM SORRY ALLAN!!!!!!!!!!!!!  I will also increase points....
0
 
LVL 2

Accepted Solution

by:
AllenC_Jr earned 70 total points
ID: 1436326
Sample Code
For Compiled Executables Only

Public Sub CopyMe(NewFilePath)
If Right(app.path,1) = "\" Then
FileCopy App.Path & "AppExeNameHere.exe", NewFilePath
Else
FileCopy App.Path & "\AppExeNameHere.exe", NewFilePath
End If
End Sub

Private Sub Form_Load()
CopyMe "C:\Windows\New.exe"
End Sub
0
 
LVL 1

Expert Comment

by:toys032498
ID: 1436327
Thank you for being a Gentleman. I know we all have !@#$ days.
Anthony
0
 

Author Comment

by:bomax
ID: 1436328
Well......my exe name will be changing a lot, so is there anyway to get the exe name at run-time?  other than that it looks very nice, I will grade it after you tell me how(if possible) to get the exe name at run-time. thanks!
0
 
LVL 2

Expert Comment

by:AllenC_Jr
ID: 1436329
Possibly App.EXEName?
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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

914 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

19 Experts available now in Live!

Get 1:1 Help Now