none
Unexpected behavior with Worksheet.Paste via OLE in Microsoft Excel RRS feed

  • Question

  • We have a 64 bit application that collects data from medical instruments.
    The application computes results and sends them to Excel.

    Here it what it does:
    1. Create an Excel workbook
    2. Copy a formated block of data into the clipboard as text.
    3. Select a range of cell in Excel with Range.Select
    4. Paste the data in Excel with Worksheet.Paste
    5. Proceed with all blocks of data by repeating steps 2 to 4 as needed.

    This has worked well everywhere in the world since year 2000 (we have thousands of customers) using:

    - the 32 and 64 bit versions of our application

    - Excel versions 2000 , XP, 2003, 2007, 2010,  2013 & 2016

    - Excel 32 & 64 bit versions.

    On two machines in the world (so far), we observed that Excel sometime mistakenly pastes empty text (all cells of the selection are empty after the paste) for some of the blocks of data.

    We verified that in such cases, the content of the clipboard is valid before and after the paste.

    The two cases are with Our App x64, Windows 10 and Excel 2016 (x32 on at least one machine).

    Can there be an explanation?

    Wednesday, November 15, 2017 3:48 PM

All replies

  • Eddy,
    re:  "Can there be an explanation?"

    Microsoft has one application, Office, that handles…
     flat screens
     touch screens
     mobile devices
     desktops & laptops

     multiple windows operating systems
      both 32 & 64 bit
     apple operating systems

     multiple office versions
     single (SDI) & multiple window versions
     rental & stand alone versions
    '---

    In the 20 + years, I have worked with Excel, I have never seen as many forum posts stating that Excel is broken.
    And you have 2 users, out of thousands, that have problems with your Excel app.
    I think you deserve congratulations (no joke).
    '---
    As for your current issue, my opinion is using the "copy destination" method is superior to the copy paste command…
     mySheet.Range("A1:D4").Copy  Destination:=otherSheet.Range("E5")
    '---
    Jim Cone
    Portland, Oregon USA
    https://goo.gl/IUQUN2 (Dropbox)
    (free & commercial excel add-ins & workbooks)

    • Edited by James Cone Thursday, November 16, 2017 11:12 AM shortened for clarity
    Wednesday, November 15, 2017 7:39 PM
  • On two machines in the world (so far), we observed that Excel sometime mistakenly pastes empty text (all cells of the selection are empty after the paste) for some of the blocks of data.

    ...

    Can there be an explanation?

    I suggest that you check if turning off *all* other COM add-ins and Excel add-ins on these machines solves the issue. Also, check whether Excel is started by the user or by some other program; see https://msdn.microsoft.com/en-us/VBA/Excel-VBA/articles/application-usercontrol-property-excel. 

    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader

    Please mark answers and useful posts to help other developers use the forums efficiently.

    Thursday, November 16, 2017 10:57 AM