Copying Excel File fails...

Hello some help is needed.
We are testing reading writing of bytes using
FileIO.FileSystem.ReadAllBytes()
And then the other side
FileIO.FileSystem.WriteAllBytes()
We have to use bytes for many reason which one is a hash of the bytes is saved in a log as evidence, other reason is the bytes must be encrypted then block communicate with certain points a crc or hash and to hardware and so forth.
So the excel file when opened says: "We found a problem with some content in 'filename.xlsm'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."
Using filecompare the files are identical (original and copy) when properties: the file properties are different, there are no author and similar property. Filled the Excel file with 2mb of data and the copy contains it all so we think the file copy is ok.
We need to make the message not appear or have proof that data is not harmed, please any advices?
We use office 2013 64bit with windows 7 64 bit. The file copy works on every file we can do binary compare and it is good. We tested with XP and 32 bit windows 7 and all of them work and do the same problem with Excel file.
My goal of posting is to make you and I better educated programmers while solving our problems ✘

I can't duplicate the problem:
Option Strict On
Option Explicit On
Option Infer Off
Imports System.IO.Path
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim desktop As String = _
My.Computer.FileSystem.SpecialDirectories.Desktop
Dim excelFilePath As String = _
Combine(desktop, "Dickson Annual Inspection Workbook.xlsm")
Dim b() As Byte = _
My.Computer.FileSystem.ReadAllBytes(excelFilePath)
My.Computer.FileSystem.WriteAllBytes(Combine(desktop, _
"testme.xlsm"), b, _
False)
Stop
End Sub
End Class
It might be the difference in the Excel version though, but the test file opened without error and contains everything the original does.
Still lost in code, just at a little higher level.

Similar Messages

  • After the Mac transfer from my old laptop to the mac, where do I find my copied excel files

    I just had a Mac transfer done from my old laptop to my new Macbook Pro and I don't know where to find my old excel files?

    What was your old laptop? Where did you keep the files on it? Please expand on the information that you have not given.

  • Excel files to n79

    Hi,
    When i want to copy excel files from my laptop to my phone via the nokia phone browser (copy, paste) I get the message "access denied" when pasting to one of the folders on my memory card.
    How can i solve this?

    I can't help you with this but have you posted on the AddressBook forum too? Maybe someone there would be better abled to assist you. Good Luck, Bob :~))
    http://discussions.apple.com/forum.jspa?forumID=753&start=0

  • "Open method of Workbooks class failed" when opening Excel file via Internet Explorer

    (apologies, I posted this first to the general Office 2010 forum, but then realized this was probably a better spot to post)
    We have an Excel COM add-in installed on users' PCs.  This add-in responds to workbook open events by opening a particular XLA file (also deployed to the PC) to make certain features available.  This process works flawlessly when Excel files are
    opened locally - but when a user attempts to open an Excel file from an IE link, we get the following error: "Open method of Workbooks class failed".  This is happening on the line that is trying to open the XLA file.  This only happens
    when launching an Excel link from IE - works fine in Chrome or Firefox.
    I have found several posts on this topic, but no solutions:
    1. This post (https://social.msdn.microsoft.com/forums/office/en-US/73c96005-84af-4648-b103-32b677205be3/open-method-of-workbooks-class-failed)
    is the closest to our problem.  In this case, the "answer" was that the user may not have access to the 2nd workbook being opened.  But in our case, we're opening an XLA that is on the local machine, and I've confirmed that it is not
    corrupt and accessible (read & write, just in case!) to Everyone.
    2. This (very old) post (http://www.pcreview.co.uk/forums/open-method-workbooks-fails-excel-hosted-ie-t965608.html)
    seems similar, but is talking about opening Excel inside of IE.  This is not what we're doing - the link is supposed to (and does) open Excel outside of IE.  Interestingly, Excel.exe is being launched with the "-embedded" flag, even
    though it isn't running in the IE window.  When launching Excel by opening the file locally, Excel.exe is run with the "/dde" flag instead.  Clearly the "-embedded" mode is what is causing the problem.  I could change the
    links on the web page to use some JavaScript to open Excel differently... unfortunately, the links are actually generated by SharePoint (the Excel files are in a SP repository), so this is not really an option.
    3. This Microsoft KB article (http://support.microsoft.com/kb/268016) talks about problems opening an XLA directly from IE... but this is the case of a link pointing
    directly to an XLA file, not opening a regular workbook that in turn opens an XLA, as is my case.  In fact, this article specifically points out in the "More Information" section that "End users do not normally open XLAs; instead they open
    an XLS that (if needed) loads one or more XLAs during startup." ==> precisely what I'm trying to do that is giving me the error!
    I've replicated the situation with a very simple COM add-in (created in VS2010 using VB.Net) and a very simple XLA file (does nothing, just pops up a message in auto_open).  For anyone wanting to try it out, here is the exact test case:
    1. In Excel, create a simple XLA file containing only the following code, and save it in C:\TEMP\dummy.xla:
    Sub Auto_Open()
    MsgBox "Auto Open fired"
    End Sub
    2. In Visual Studio, create a new Excel 2010 Add-In.  I created mine via Visual Basic, but I doubt the choice of language matters.  Place the following code in ThisAddin.vb:
    Public Class ThisAddIn
    Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
    AddHandler Me.Application.WorkbookOpen, AddressOf Application_WorkbookOpen
    End Sub
    Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
    End Sub
    Sub Application_WorkbookOpen(ByVal workbook As Excel.Workbook)
    On Error GoTo ErrHandler
    If (Not workbook.Name.Contains("dummy.xla")) Then
    MsgBox("Workbook open")
    Application.Workbooks.Open("C:\temp\dummy.xla")
    Application.Workbooks("dummy.xla").RunAutoMacros(Excel.XlRunAutoMacro.xlAutoOpen)
    End If
    Exit Sub
    ErrHandler:
    MsgBox(Err.Description)
    End Sub
    End Class
    3. Build & publish this add-in and install it on the same machine as the XLA created in step 1.
    4. Create and save an empty Excel workbook (I called mine WayneTest1.xlsx) - save it locally (on your desktop), and put a copy somewhere on your web server (I put mine directly in c:\inetpub).
    5. Create an HTML file with a link to that workbook, saving it to the same web server location - here is mine:
    <html>
    <body>
    <a href="WayneTest1.xlsx">Link to Excel file</a>
    </body>
    </html>
    6. Double click the workbook on your desktop (from step 4) - opens fine, I get the "workbook open" message, following by the "Auto Open fired" message.
    7. In Internet Explorer, navigate to the HTML file specified in step 5 and click on the link - when prompted, select "Open" - I get the "workbook open" message, following by the error message "Open method of Workbooks class failed".
    Here are a few things I've ruled out / tried so far:
    - Unchecked all the "Protected View" settings in Excel, made no difference
    - Unchecked all the "File block settings" in Excel, made no difference
    - Made sure dummy.xla was open for read & write to Everyone
    - Made sure the web page was in Trusted sites and set the security level to Low for those sites in IE
    - Tried making the local desktop file (step 6) readonly, made no difference (i.e. launching it locally still worked fine)
    - Tried using Excel 2013 - made no difference
    Any ideas / suggestions?

    Hello Wayne,
    Apologies for the delay.
    I went through your post and tried to reproduce the issue. I was able to reproduce it. Based
    on its complexity and as it requires more in-depth analysis, your question falls into the paid support category which requires a more in-depth level of support.
    Please visit the below link to see the various paid support options that are
    available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
    Thanks,
    Anush

  • C# Script to copy an Excel File working locally but not on the server when I schedule a job

    So I have these couple C# commands to copy an Excel File which works fine and dandy on my local client when I test and run this SSIS Package but when I tried scheduling the job on the server, it failed.
    These are the couple C# commands...
    // This Opens the Source .xlsx File from Emdeon ePaySmart
    Workbook workbook = excelApplication.Workbooks.Open(StringSourceFile, XlUpdateLinks.xlUpdateLinksNever, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
    // This will Save the Source .xlsx Emdeon ePaySmart File as a .xls File...note xlFileFormat.xlExcel5
    workbook.SaveAs(StringDestinationFile, XlFileFormat.xlExcel8, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
    Is this because I'm using xlFileFormat.xlExcel8 and locally it is running fine but when I schedule via SQL Server Management Studio as a SQL Server Agent Job it seems to be failing??
    I sure hope I don't have to change this so it will run as a SQL Server Agent Job and/or run this locally every blessed week.
    Can someone clear this up for me and provide a potential solution?
    Thanks for your review and am hopeful for a reply.
    ITBobbyP85

    That is Excel automation, which requires Excel to be installed on the computer where the code runs, and is not supported on a server without an interactive user logged in.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • ITunes v10.6.1.7 "Copying files failed. The File name was invalid or too long."

    I'm trying to organize my music files using iTunes 10.6.1.7 and I keep getting the error message "Copying files failed. The File name was invalid or too long."
    I've got music folders by artist in both the iTunes Music folder and the iTunes Media/Music folder. When I add certain files by drag/drop they sometimes get lost and I don't want that to happen anymore. I used to just consolidate my music files using the File/Library/Organize Library option and that worked, however now when I do that, I get the error message.
    I'm a novice and the only online stuff I see is both confusing and refers to earlier versions of iTunes.
    My concern is that I have heard that people lose entire libraries of their music when they trry to fix things like this and I don't want that. If this is of any importance, I have several files called iTunes library and temp library. I have no idea what that all means but I'm scared to death of it.
    Also, I can't get to the "re-organize library" link at all. It won't let me.
    One thing that be of some interest is that when I pull up the properties of the music and media/music files they are marked "read only" I'm also afraid to touch that!
    Please help and please know that I am a dummy. Be kind and be clear. Step by step would be great, with images even better. Thanks.

    Perhaps nobody knows the answer? We're fellow users here answering questions in our free time when we think we've something useful to contribute.
    You can choose to *Consolidate selected tracks* with a right-click menu. Perhaps if you can identify a specific track that won't consolidate and examine the full path to the file & the path that iTunes would create when it consolidates the problem might become apparent. For example iTunes may not be able to move files if the source or destination path length exceeds 255 characters.
    tt2

  • Moving library to external hard drive and get the error "Copying files failed. The disk could not be read from or written to"

    Hello,
    I'm moving my library to an external hard drive.
    I've made sure to use the 'Keep iTunes Media Folder Organized' option when pointing to the new library location.
    I select 'File'->'Library'->'Organize Library', I select to 'Consolidate Files', click 'OK' and get ther error message "Copying files failed. The disk could not be read from or written to".
    I've read elsewhere that there may be a corrupted file that I need to sequester somehow and perhaps add it back however I'm not certain how I can locate that file because the status window doesn't indicate which file it's attempting to transfer when the error appears.
    Any tips?
    Thank you,
    Greg H
    iTunes 10.6.3

    OK I figured it out!
    It was a dodgy file....I sorted the file folders by date, and as it turned out within the "compilations" folder there was a CD where only about half the tracks seemed to have been copied over. Could not have identified this simply from the time indicated on the finder folder sort, because there were several CDs copied over in the that same minute.
    I went back to the original itunes folder, deleted all the files from that CD in itunes, then also deleted all those files from the original disk and the target disk.
    Tried the "consolidate library" again, and it completed nicely. 200megs of music and videos.
    Very happy to solve this problem after 3 weeks.

  • Itunes wont consolidate becuase "copying files failed...."

    itunes wont consolidate because "copying files failed. The file name was invalid or too long." why to i get this error message and how do i fix it? I am using itunes 9 on a dell windows xp laptop. i am trying to consolidate the library but it does not work becuase of the error message. please help. Thank

    I'm having similar problems, but Katrina S's suggestion didn't work for me. From my desktop, I'd transferred my music files to an external USB hard drive and the library database files to my laptop. iTunes plays perfectly, but I get the same error message when I try to consolidate. I changed permissions on the external drive and on the iTunes library folder, when needed, to make sure either my user logon or an administrator (which includes me) had full permissions. Still can't consolidate, though. CarolynOtt, did you find a solution yet?

  • Copying files failed. An unknown error occurred (-50)

    I currently have a PC (Samsung Q330 running Windows 7) and I am getting a Macbook Pro in a few days! Therefore I am transferring my iTunes (10.6) library to an external hardrive (Hitachi X250). While I was doing this I received an error message that read “Copying files failed. An unknown error occurred (-50)”. Therefore I was wondering, how the heck do I fix this???
    What I have done.
    I have gone in to “Advance Preferences”.
    I have changed the “iTunes Media folder location” to my external hardrive.
    I have the following two option selected “Keep iTunes Media folder organized” and “Copy files to iTunes Media folder when adding to library”.
    Then I go to File> Library> Organize Library. Then I select “Consolidate files” then I press the “OK” button.
    Then about half way in or so I get a pop up that reads “Copying files failed. An unknown error has occurred (-50).
    As you can see iTunes is not working. Could anyone help me???
    Thanks in advance, Donald Louch!

    Hmm... you may find iTunes is still connected to some files in the original location rather than the new one. You can check with my script Unconsolidated. If that is the case the script ConsolidateByMoving ought to switch the connection to a file already in the correct place however I'm currently working on a new build so the behaviour of the live version might be slightly different.
    tt2

  • When trying to 'Consolidate Files' via iTunes I get the message "Copying files failed. The name was invalid or too long."

    I am trying to copy my entire iTunes library and everything in it from my PC Desktop to my PC Laptop using the "External Drive" method as shown on the Apple website. On Part 1 (5) I am told to consolidate files. When attempting to do this I get the message "Copying files failed. The file name was invalid or too long."
    How do I resolve this?

    I have just been having this problem and it has been driving me mad.   The error message doesn't tell you which file is causing the problem so you can't fix it and it leaves your libray in a state of limbo with some files copied into the new location and some in the old location.  After many hours I found a surprisingly quick and simple solution.
    1) in iTune create a smart play list that includes everything that was added before tomorrows date.  This will include everything.
    2) Right click this playlist and export it as a text file to produce a tab delimited file.
    3) Import this into a spread sheet, or just view it in a text editor with line wrap turned off.  What you are interested in is the last column (or end of the line in a text editor).  This gives you the path of the file associated with each entry in the library. 
    The path of the files that have already been copied successfully will start with the new location for your media files you specified.  Scroll thru the rows until you get a blank path.  If you start getting paths starting with the old Media file location then you went to far and start scrolling back.
    The row with the blank path was the file that failed.  Move back to the start of the row to find out more about it.  In my case it was a podcast with a very long name. I just deleted that podcast from iTunes.
    4) Restart the consolidation by choosing File, Library as you did before and the process starts again where it left off.
    5) If it fails again on another file just repeat the process

  • Consolidate Problem. Copying files failed. The File name was invalid.

    Hi to everyone,
    My system is 10.5.8, iTunes 9.2.1 (4)
    I tried to consolidate my iTunes library to an external HD. After about 100GB of copied music, I got the message : Copying files failed. The File name was invalid.
    Now everytime I try again to consolidate, I get immediately this message. I am looking everywhere for a solution, and I only find the same problem for Windows iTunes users.
    Actually I found very useful this thread:
    http://discussions.apple.com/thread.jspa?threadID=1708372,
    which talks about with which order iTunes consolidates the media, so by digging a little in the folders to find which track has the problem and make the fix. It says that consolidate start copy the files by the date added order. So I can go in my new iTunes media folder and find the latest added track, then go back in iTunes, sort by date added the songs and locate the next song, to make the fix. However in my case, all previous and next songs (by date added), have been copied in the new locations.
    I am stuck. I have a remaining 300GB of music to consolidate and dont know how to proceed.
    Any help would be much appreciated..

    Finaly, I managed to solve it by myself...,
    following the help I found from the post of the thread I mentioned on my question...
    What was the problem that made things more difficult in my case, is that a big amount of songs have been added at the same time, with just a few seconds time distance. So it was tougher to locate what was the last imported song, and where iTunes consolidation had stopped. Actually I had groups of about 100 songs with the same timestamp of date added and the consolidation was following the rule of the "date added" but not exactly with the order the songs was showing in the iTuned library. So I started checking all the songs very close to the last added in the media folder one by one with the "show in finder" command, and then I managed to found what was the one with the problem.
    Regarding the problematic file, that was a midi file that had been imported in my iTunes.
    I hope this will help anyone else that might have the same problem as me in the future.

  • HT1751 I did all of the above and at the "Consolidate files" screen I clicked "ok" then it sayd "copying files failed. the file name was invalid or too long" and I had to click "OK"  I cannot consolidate the files to transport  to my external harddrive -h

    I would like to backup my itunes to my external hard drive
    I did all the steps up to "organize Liberary" which at this point I checked the box and the clicked"ok"
    it then said "copying files failed.  The file name was invalid or too long" "OK"
    It will  not let me consolidate the files so I can transfer to my external hard drive
    what am I doing wrong - any suggestions?
    thanks,

    Are you using consolidate files to bring in stray files to your main iTunes Media folder before backing up, or to copy the media folder to the external drive as part of backing up? If it is the latter then you are taking the wrong approach. See this user tip.
    Run my script Unconsolidated on the library. It will show you the remaining unconsolidated files which might give a clue as to which files iTunes is having a problem with. You can consolidate selected files in batches (select, right-click) as opposed to trying to do everything in one go. Alternatively you could try moving the remaining unconsolidated files with ConsolidateByMoving as long as this step is a precursor to a backup..
    tt2

  • I am using itunes 10 and trying to consolidate my files.  I keep getting the error "Copying files failed.  The file name was invalid or too long".  How can I indentify what file is causing this problem or resolve this issue?

    I am using itunes 10 and trying to consolidate my files.  I keep getting the error "Copying files failed.  The file name was invalid or too long".  How can I indentify what file is causing this problem or resolve this issue?

    BUMP
    Yes, I just get that message. I don't see how I could investigate this problem.
    I didn't mention that this happened when I was consolidating my library, not copying files to another computer.
    In other words, I'm using a "normal" itunes procedure, itunes won't complete it, and won't tell me exactly why or how to figure out how to fix it...
    Is there at least some easy way to tell which files were successfully copied to my itunes music folder so I can work on moving the uncopied files?
    Can anybody help me?

  • HT1751 Consolidating ITunes Library Failed - message received: "Copying files failed. The file name was invalid or too long" . Please help - how to i fix this issue?

    I consulted your website for details on how to back up my ITunes Library on my PC-found the article very helpful-I reached step 7 - clicked ok and the following message came up: "Copying files failed. The file name was invalid or too long."  Please can you help and advise what I should do or how to fix this issue.   My pc operating system is Windows 7 Home Basic

    You can select a group of tracks and consolidate from the right-click context menu. You coud try consolidating in batches, say all songs by artists beginning with A, then B, etc, then the other media types, until you can isolate a problem track and then try moving that by hand and fixing the broken link.
    I also have two scripts that could help you, Unconsolidated and ConsolidateByMoving. The first can make a playlist of all unconsolidated tracks, the second can consolidate a selection of tracks by moving them instead of copying.
    tt2

  • HT1449 copying files failed. the disk could not be read from or written to.

    Im moving my iTunes to an external hard drive. Its moved about half already and Im now getting this error. I have no idea what file its getting stuck on so I cant remove that file. When I restart it it will say preparing to copy then I get the error right away. I dont want to delete the extrenal and start over if I dont have to.

    Ive already changed the location for my itunes media to my extrenal hard drive so when i click to consolidate files Im getting the error
    copying files failed. the disk could not be read from or written to

Maybe you are looking for

  • Delivery and Goods Issue

    Hi,   I am new to SAP and was trying to do a Goods Issue after creating a delivery. When i click on Goods Issue from the delivery document, I get the message " Storage Location not defined for delivery item 000010" When I try to go to picking overvie

  • GRMG RFC Configuration "HTTP method GET is not supported by this URL"

    Hi All, when i create the RFC Destinaton for SLD  with regards to GRMG Configuration and test the rfc i get the Reason code 400 with error "HTTP method GET is not supported by this URL". Even if i call  http://hostname:port/sld/rtc in the browser i g

  • Update and Write Back DataTable in Object Variable Using Script Component

    Hi All.. I'm trying to update an Object Type Variable [ReadWrite] with a Data Flow Task Script Component. Variable is already holding a record set with Column(s) like, ID, Name, IsProcessed. Now in my Data Flow Script Component, I'm trying to 1st) Fi

  • How to execute the blocks in java

    Hi I have doubt on block programing class A{ System.out.println("hai"); public static void main(String[] args){ A a = new A(); compile and run the code the its display "hai" in console how is it possible. How it default called ?

  • Ipod Games problem!

    Hey there - i won this competition a while back, and got an itunes gift card. I bought lots of ipod games, and just recently - when i try and play them, it says error: This game cannot be played. Connect your Ipod to Itunes and reinstall the game. Fo