Solved

Copying currently open file

Posted on 1998-09-23
10
146 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
Comment Utility
Use File Copy...
0
 

Author Comment

by:bomax
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:bomax
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you for being a Gentleman. I know we all have !@#$ days.
Anthony
0
 

Author Comment

by:bomax
Comment Utility
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
Comment Utility
Possibly App.EXEName?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

771 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

11 Experts available now in Live!

Get 1:1 Help Now