Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Office clipboard - controlling programmatically ?

101 views
Skip to first unread message

salil_taneja

unread,
Jul 1, 2009, 9:32:13 AM7/1/09
to
Hi,

Can we control Office Clipboard programmatically?
I am not able to find much on this. I am using PowerPoint 2007 on Windows
Vista.

Even checking whether Office clipboard is active or not will suffice for my
use case.

My Scenario - I have my own implementation of IDataObject::GetData function.
When I do a copy, my function gets a call from the Office Clipboard.
When i do a paste, my function gets a call from the application which is
trying to paste the content.
I want to differentiate between the 2 scenarios in my patched function.

Any help will be appreciated.

Thanks & Regards,
Salil

JP

unread,
Jul 1, 2009, 4:45:03 PM7/1/09
to
Here's a function I use to copy text to the clipboard from any Office
program.

Function CopytoClipboard(textToCopy As String)
' code adapted from:
' http://www.dailydoseofexcel.com/archives/2004/12/02/putting-text-into-the-windows-clipboard/

Dim objDataObj As DataObject
Set objDataObj = New DataObject

With objDataObj
.SetText (textToCopy)
.PutInClipboard
End With

End Function

HTH,
JP

On Jul 1, 9:32 am, salil_taneja

purkers

unread,
Aug 13, 2009, 8:30:01 PM8/13/09
to
I can't get VBA to recognize "DataObject" [Outlook 2007]. What References
am I missing to get this (as in Tools | References...)? Sorry I'm kind of
rusty at this.

Any suggestions will be greatly appreciated!

Scott

Jay Freedman

unread,
Aug 13, 2009, 9:57:23 PM8/13/09
to
Set a reference to the Microsoft Forms 2.0 Object Library. The easiest
way to get this is to insert a UserForm in your project; you can
remove it later if you don't need it.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

salil_taneja

unread,
Aug 14, 2009, 12:34:01 AM8/14/09
to
Thanks JP !
But with the object model provided by Office, is there no way to control
Office Clipboard ?

-Salil

salil_taneja

unread,
Aug 14, 2009, 12:36:06 AM8/14/09
to
Hi Jay,

Can you suggest any way using which I can differentiate between the 2
scenarios above in the original question?

Regards,
Salil

Jay Freedman

unread,
Aug 14, 2009, 7:56:15 PM8/14/09
to
Sorry, no. For whatever reason, Microsoft has never exposed *anything*
about the Office clipboard in the VBA object model. The DataObject
gives access only to the Windows clipboard, and that's only for text
and not for any other kind of clipboard content.

As you've written your own IDataObject::GetData function, I assume
you're doing that in Visual Studio or VSTO. I've never gotten involved
in that.

jaf

unread,
Aug 15, 2009, 10:08:26 AM8/15/09
to
Correct, but there are always API's.
http://support.microsoft.com/kb/159823
http://msdn.microsoft.com/en-us/library/aa262347(VS.60).aspx

John

"salil_taneja" <salil...@discussions.microsoft.com> wrote in message news:4506B68D-FCAF-463E...@microsoft.com...

Jay Freedman

unread,
Aug 15, 2009, 4:52:52 PM8/15/09
to
Repeating what was said in the other branch of this thread, the APIs
discussed in those two articles deal with the Windows clipboard, not
with the Office clipboard.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
0 new messages