Office clipboard - controlling programmatically ?

S

salil_taneja

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
 
P

purkers

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
 
J

Jay Freedman

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
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

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

JP said:
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
 
S

salil_taneja

Thanks JP !
But with the object model provided by Office, is there no way to control
Office Clipboard ?

-Salil
 
S

salil_taneja

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 said:
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
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

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

JP said:
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
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
 
J

Jay Freedman

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.

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 said:
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
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

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

:

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
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
 
J

Jay Freedman

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
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top