File.Copy Simply Doesn't Work by Itself VS2012 Excel

Simply copying a file from one directory to another using file.copy(sourcefilename, destfilename, true) never works because the sourcefile is always in use! Always!
If I run this simple code in debug it works fine, but without debug the source file is ALWAYS in use.  I used the file.copy method back in VS2005 on xml documents and it worked fine back then.  Now, using Excel files, it NEVER works.
Clearly I'm missing something.
Ross

I assume you are missing something. I created a test project with the following.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim folder As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments
Dim sourcePath As String = IO.Path.Combine(folder, "Test.xlsx")
Dim destPath As String = IO.Path.Combine(folder, "ExcelTest", "Test.xlsx")
IO.File.Copy(sourcePath, destPath, True)
End Sub
As long as Test.xlsx exists in My Documents and there is a folder called ExcelTest also in My Documents, the file is copied to the ExcelTest folder. It works both within Visual Studio and when running the compiled exe outside Visual Studio.
Is it possible that the file really is in use?

Similar Messages

  • Backup Assistant Plus simply doesn't work, how do I disable it?

    I have a shiny new Samsung Galaxy S III and when I set up my contacts, I added them as "Phone" entries with the expectation that the Backup Assistant Plus app would allow me to back them up. Except that it doesn't and, from what I've seen online, it is a miserable piece of junk that simply doesn't work for many people.
    Soooo....
    I sent all my contacts as a big V-card to my Gmail account, sorted things out in Gmail, unjoined them all on the phone, and deleted the Phone entries. Now I only have Gmail contact entries and they synch with no issues.
    My only question now is, how do I disable/stop Backup Assistant Plus so that it doesn't constantly give me notifications about how incapable it is? I've tried clearing it's data and forcing it to stop. But it comes back from the dead, like a demonic zombie! It appears the only thing the app can do is resurrect it itself for the sole purpose of notifying me that it will fail to do anything useful.
    Any and all help with this issue is greatly appreciated.

    greblaws wrote:
    I have been trying to disable Backup Assistant Plus since it is a BATTERY and PERFORMANCE HOG!  I have a lowly Droid3, and it has been really causing issues.
    Your instructions above DO NOT WORK, under Manage Applications I get "Uninstall updates" - I cannot uninstall it. It is a "system application" and I am locked out of that control.  GRRRR.  Clear data does not do anything for performance.
    Even when on wifi, this app's backup of data is slower than TAR in January.  Biggest issue is the
    The reason the steps to uninstall the app didn't work is because the DROID 3 is running Gingerbread (Android 2.3).  The instructions above were for the Samsung Galaxy S III running either ICS (Android 4.0) or Jelly Bean (Android 4.1).
    You can however "Clear the Data" for the app and from that point never use the app.  The phone will learn to not load it into the RAM in case you ever use it.

  • Copy Paste doesn't work during and after a remote login session

    Hi 
    I am using a Windows 7 Home Premium Service Pack 1 laptop to login into Linux. I am using Putty and Xming to SSH and view the desktop. Whenever I start a session the copy paste functionality gets disabled in my laptop,i.e., I cannot copy text from one text
    file to another or within the same text file. The copy paste doesn't work even upon closing the connection. 
    From what I have gathered it is not possible to copy from one computer(host) to another(guest) during a remote login session but I am not able to copy within my windows laptop. 
    Is there some setting that I need to change to prevent it from happening? What are the possible solutions?
    Thank You
    Rishabh

    Hi,
    Are you able to copy and paste in the putty session, with mouse or keyboard?
    Using PuTTY
    http://the.earth.li/~sgtatham/putty/0.52/htmldoc/Chapter3.html
    Please restart your PC to check whether you can get back the copy and paste function. It can be caused by some compatibility issue.
    Please also run "sfc /scannow", check if it find and fix any errors.
    NOTE
    This
    response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft
    does not control these sites and has not tested any software or information found on these sites.
    Regards
    Yolanda
    TechNet Community Support

  • HT4527 How on earth do you get Home Sharing to work properly?  We have tried multiple times and it simply doesn't work for us!

    How on earth do you get Home SHaring to work?  We have tried numerous times and it simply doesn't work for us!

    Turn it on.
    Honestly, if you want help it is generally a good idea to ask a specific question and give some details of what problem is occurring.
    If trying to move media, using home sharing is simply a bad idea.  Follow some of the other instructions in the article from which the question was posted to move media.

  • Why is my diabled login greyed out after i unlock it? I have tried to remove the library file but it doesn't work

    Why is my diabled login greyed out after i unlock it? I have tried to remove the library file but it doesn't work. It worked the first time and than all of a sudden it was greyed out.

    Where do you see a disabled login? In system preferences? In Login screen?

  • HT204382 I just bought Quicktime MPEG - 2 to play MPG video files and still doesn't work. any suggestion?

    I just bought Quicktime MPEG - 2 to play MPG video files and still doesn't work. any suggestion?

    Please note:
    If your Mac has OS X Lion, MPEG-2 functionality is built in and the QuickTime MPEG-2 Playback Component is unnecessary.
    QuickTime MPEG-2 Playback Component for Mac OS X - Apple Store (U.S.)

  • Copy Function Doesn't Work After Updating user.js File

    I tried the Copy Function at the web site www.gogvo.com and got an error message from Firefox that Copy wasn't enabled. I got more info and created a user.js file in my Profile with the above site inserted following directions on the Troubleshooting Help page. I restarted Firefox but still can't use the Copy Function when I right-click a highlighted field to Copy. I have no problem when I use Internet Explorer 9 with my Windows 7 Home Premium. I have the latest version of Firefox. I have no problem copying on other sites, such as MSN Hotmail.

    I tried {Ctrl+C} and that doesn't work. I deleted the user.js file and downloaded the allowclipboard-helper file extension, and that doesn't work. I only have this Copy/Paste problem HERE: [http://www.gogvo.com/affiliates/optin_message.php GVO Responder Opt-in Message Edit] and don't have any Copy/Paste problems anywhere else. Is there another solution to try?

  • Upload file jsp code doesn't work? How can I debug

    Hi Everyone,
    I have the following jsp code that simply adds a new product to the backend database when 'Continue' button is pressed.
    if( "Continue".equals(fp.getParameter("Submit")) ) {
         fp.setParameters(prodForm);
         prodForm.setCreateBy(currentUser.getUserID());
         prodForm.save();
         String filename = fp.getFilename("file");
              if( filename != null ) {
              // a file was uploaded
              // set the path to save it
              fp.setFilePath(PHYSICAL_PATH + "uploads\\");
              // we will change the filename to make sure it is unique
              // need to keep the file type
              String fileType = "";
              try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
              catch( Exception e ) { fileType = ""; }
              fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
              prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
              prodForm.save();
         db.close();
         response.sendRedirect("index.jsp");
         return;
    }The code works fine but the upload doesn't work. This is the upload part of the above code:
    String filename = fp.getFilename("file");
              if( filename != null ) {
              // a file was uploaded
              // set the path to save it
              fp.setFilePath(PHYSICAL_PATH + "uploads\\");
              // we will change the filename to make sure it is unique
              // need to keep the file type
              String fileType = "";
              try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
              catch( Exception e ) { fileType = ""; }
              fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
              prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
              prodForm.save();
         db.close();
         response.sendRedirect("index.jsp");So if the file browser, <input type="file" name="file">, has a file, then it saves the file in the upload folder and saves the filename in the database. But it doesn't work, it doesn't save the file in the upload folder nor it saves the filename in the database. I am new to java and jsp so could you tell me what error checking or deguging I can do in jsp to spot the problem.
    Thanks,
    Zub

    where u write the code to upload the file
    to server end?

  • Find files in folder doesn't work

    To make my photo galleries, I use CS5, because this is the last version that can use modified galleries that I was able to since CS3.  My modified pages have links to other pages on my web site, while the ones that now come with Photoshop are dead end with no links.
    So, another feature lost in later Bridges is the ability to show ALL the contents of a folder and its subfolders.  To get around this, I choose to show folders whose metadata or filename DO NOT contain zzz, since none do.  This has worked fine and I have made hundreds of galleries from my phylogenetic folder trees of species.
         Until I came to this gallery of Tachinidae. I have been updating all my Arthropod species galleries  After I did the usual procedure, and created the gallery (and deleted the previous gallery both on my PC and the web), I noticed that the first image was a Belvosia, and there were non of the Archytas or other species that should have come before, alphabetically.  I tried again and found that it was ignoring a lot of files in some subfolders that should have come up.  I tried other finds, like all files ending in .tif, or all that had the keyword Tachinidae, and always the same result.
         Then I tried the same search in CS6 and it finds all, but of course I can't make my galleries here,  I went back to CS5 and made a new folder TACHINIDAE 1  and moved all the files there and tried again, with no success.  I tried a backup file with the same result.  Rebooting didn't help.
         Today I tried again and as it did the search, I could see it indexing the Archytax subfolder and others that were not included, but now after  over 30 minutes, all I have is a spinning circle and no items.  I had gone back to other folders that I had made galleries of just before and they pull up all the images, as before, but this has stopped my progress in this project dead in my tracks.
         I can't make any sense of this at all.

    Well now it's not working at all.  I moved the folder to a higher level of my directory tree, with the same result.  then I just tried a subfolder and it quickly found that there were no images, either that didn't have zzz or that ended in .tif.
    Than I tried another family folder and it quickly found no images according to the criteria.  So now the search function just doesn't work.

  • IChat in Lion simply doesn't work

    I have a 2008 Mac Pro that has been through Leopard, Snow Leopard and now Lion upgrades.
    And a 2011 MacBook Pro that saw an upgrade to Lion.
    I cannot get iChat to work on either machine. Both have been transported to several different locations (hence different ISP's and router configurations), I have tried deleting and re-adding my AIM account on both machines as well. Have tried SSL on and off, Wifi, Ethernet connections. Nothing seems to work.
    Username and password are obviously fine. It simply doesn't change from "offline". I have tried changing via Status, via iChat > Log In, nothing. No messages, no error messages, its like it doesn't even realize I'm giving it a command. Have also tried changing port settings, connecting without a router at all, etc. I'm very confident it is a software issue/bug, not something with my connection. As it worked just fine before the Lion upgrade (on both machines)
    Any suggestions?

    Hi,
    Thanks for the Points.
    The steps were listed in the least Destructive first.
    They also served to show that it could be one or two causes.
    The IMAgent issue has the possibility of messing up Face Time as well.
    The Keychain issue could cause you issues with several apps like the Address book and Mail as well as Face Time and iChat due to the interlinking created by the Address Book use of your Contacts' info.
    Although the last does and is sometimes the only course of action it is relatively extreme and lacks a certain finesse.
    Doing all three without checking in between is a bit over the top in my book, and misses out of the staged learning I was trying to also get across.
    Glad to hear you have it working.
    8:49 PM      Thursday; October 6, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb( 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Mov file in Keynote doesn't work in 4.0

    I've been a presenting a Keynote file that includes many imbedded animations (mov or mpeg files) I did not create. I just upgraded to Keynote 4, and now one of the slides has stopped working. This shows Lake Chad slowly drying up (from Gore's presentation in An Inconvenient Truth), and previously it dissolved slowly from the Lake in 1963 through intermediate steps until it is gone in 2001. Now it freezes in 1963 and the jumps to 2001.
    When I view package contents on the file, and double click on the mov file (there are actually a couple that I see), the movie runs fine in Quicktime. Anybody have any ideas for me? I'm making a major presentation using this file on Thursday. I guess I can save as an earlier version and reinstall Keynote 3...
    Thanks.
    Andy

    I just open my next weeks lecture form last year and the movie doesn't play... The movie is a 281 MB H.264 movie... I can open it in quicktime and it works fine, plays in keynote 3 just fine. If I put the movie in a new presentation file it doesn't work... The preview thumbnail slide along the edge shows the movie, but it's just a blank white pane in the slide.
    I just searched my HD and popped in a whole bunch of .mov movie files and they all play just fine, until I put in another H.264 one, it is also just a blank white window...
    I can't believe apple didn't test H.264 in keynote 4 so this must be a setting somewhere, right?
    please don't make give his lecture in powerpoint!

  • How do you save data into an excel file while myRIO is acquiring data? I tried saving it using "Write to file" but it doesn't work for some reason.

    I am acquiring cosine wave and a pulse wave as input and I want to store their peak to peak values into an excel file. "Write to File" is not working for it. Is there any other vi which can be used for data logging?
    Thank you for your help.

    Hi Ssheoran,
    Can you provide more detail when you say that the Write to File VI doesn't work? Is there an error given? Or can you just not find the file on your computer? Keep in mind using this file in a Real-Time VI on the myRIO will save files on the myRIO. You will then have to transfer to your PC. Please view the following video as a guide for saving files and transferring them to your computer: (http://www.youtube.com/watch?v=BuREWnD6Eno). Hope this helps.
    Best Regards,
    Roel F.
    Applications Engineer
    National Instruments

  • Finding XML file from EJB doesn t work.

    Hi all:
    I have an EJB accesing a XML file to parse a XML document. The file is in the classpath, and sometimes the EJB finds it and sometimes not.
    What happens?
    When the EJB finds it, DOMParser method, parse(InputStream), doesn t work.
    I use this file to config DB connection externally for my BC4J (I don t use JTS).
    Thanks in advance.
    Joaqumn.

    Well, it won't work as iWeb has no import facility so cannot open html files.
    What you could do is upload the html file to wherever you are hosting your site and create a link to it from iWeb, or find another package similar to the one you are using at present that is for Mac rather then PC.

  • "open file in Photoshop" doesn't work any more.

    When I right clicked a picture in Lr (most recent version) and selected "open file in Ps (CC 2014)" Photoshop launched, but the image didn't show up.
    I tried several times, with Ps closed or open, but to no avail. Opening the file as a "smart object in Ps" works, and also opening the file in a third party application (Perfect Effects 8) works fine. Just Ps CC 2014 doesn't load the image from Lr.
    Any hints?
    Mac OS X 10.9.4 and Adobe CC, all products at the most current level.

    See this article:
    Edit In doesn't work in Lightroom 5.5 from Photoshop CC 2014

  • Copy/Paste doesn't work in Address Bar and Smart Search Field

    Yeah, that's true. Say, I copied a sentence from a site. When I try to paste that sentence into 'Smart Search Field' and press 'Enter'. It doesn't work! Same thing happens when I try to paste a URL into Address Bar/Smart Address Field. What's going on? Anyone else having this problem?
    PS - In case you're wondering what 'Smart Search Field' is, here's a pic http://images.apple.com/safari/images/features-search-smartsearch-20090528.jpg

    Yes, I've got that too. It's not clear why it hits some people and not others. Haven't seen any commonalities among the reports that I can tell at the moment.
    Some workarounds discussed in this thread:
    http://discussions.apple.com/thread.jspa?threadID=2564687&tstart=0

Maybe you are looking for

  • Short Dump ASSIGN_TYPE_CONFLICT in Virtual KF implementation

    Hi Iam getting a short dump in my virtual KF code. Here is the code that I have written. If I have only bill date it works fine. The minute I add company code it gives the short dump. Can you pls let me know what is it that Iam doing wrong. any help

  • Http to abap proxy

    Hi ; Can somebody help me by sending screenshots for a http to abp proxy scenario. I am new to sap xi . i need a http cleint also, Thnx

  • Question in regards to multiple addresses and phone numbers in one contact...

    Hello iPhone users! I have a quick question in regards to contacts. If I have a name of a restaurant that has two separate phone numbers and two separate locations, do I need to create a separate contact for each location and each phone number? For e

  • Function module to get md04 data

    I need function module to get below data of the material as per the mrp area. Thanks, Kiran

  • Htmlcss Problem in calling Report using Forms 6i

    Hi My form6i server is on win2000 server. I am calling Reports(Report6i) using forms 6i, my problem is when html report get generated in a IE browser, cell border AND background color are not coming, i tried desformat property set as htmlcss even tho