Why does opening Excel 2010 clear the clipboard?

RichStone

Registered User.
Local time
Today, 10:51
Joined
Oct 18, 2013
Messages
21
I've had a problem for a while which I posted up in another section, but I think it was getting too 'off track' so based on my findings, here's my issue:

In my database I have a field with contents I want to copy and then paste into Excel. Whilst in development, I've made sure the field is visible so that I can see when it has any content. I have placed a button next to the field that copies its content to the clipboard. This works fine and can be confirmed if I open Notepad and paste the content into it with no issues.

The problem starts when I open Excel. I've tried opening it using another button and manually and the same thing happens when I try and paste the clipboard content into it. It's empty! I can't even directly paste into Notepad once Excel has opened. However, if I go back to the database with Excel already open in the background, I can hit my copy button and the content pastes into Excel with no issues. This proves my code is fine.

So my conclusion that it must be something that happens when Excel opens. Does anyone have any ideas?

Also, it may be worth noting is that it was working perfectly when I was running Access 2007 and Excel 2007...
 
Thanks for the reply.

The function that the article describes just seems to turn the clipboard strip on the left side on and off rather than the actual office clipboard. But it has allowed me to see what's happening and it appears that for some reason something else in in the clipboard list before the content I am trying to paste. If I click 'Clear clipboard' in Access before copying, it pastes fine in Excel... So now I've got to work out why it only does this when opening Excel from Access and not if I'm pasting in to a program other than an Office 2010 application...
 
So now I've got to work out why it only does this when opening Excel from Access and not if I'm pasting in to a program other than an Office 2010 application...
The Office suite of apps share the Office Clipboard. That is probably why it has this behavior between office apps.

As a test, what happens if you rename your database to have a .accdr extension and ntry it? This will force Access into runtime mode which I believe also turns off the office clipboard in Access. This may get around the behavior.


Also, how are you putting data on the clipboard? Are you using DoCmd.RunCommand acCmdCopy or the Windows API?
 
Last edited:
I think this was a "fix" that impacted Word also. I'm not sure when it happened. The behavior seems to have been happening for several months or possibly longer. I don't do copy and paste in applications but I have noticed it because I frequently cut parts of web pages and paste them into Word. If Word isn't open when I make the copy, then I can't paste so I have to remember to open Word first.

I know this isn't an answer but it may explain why it is happening. If you are doing the copy and paste manually, just open Excel first. If you are trying to do this with code, either open Excel first or better yet, use OLE automation to put the value into the cell you want to update.
 

Users who are viewing this thread

Back
Top Bottom