Clipboard

A

Alan T

How to I save the contents of clipboad to the variable and reassign the
content back to the clipboard ?
 
A

Alan T

Hi,

I use the following to save the content and restore to the clipboard but
finally the clipboard is empty:

private IDataObject _clipboardContent;

private void StoreClipboardContent()

{

_clipboardContent = Clipboard.GetDataObject();

}

private void RestoreClipboardContent()

{

Clipboard.SetDataObject(_clipboardContent, true);

}

As I called:

StoreClipboardContent();

rngTarget.Copy();

rngInsertBookmark.Paste();

RestoreClipboardContent();



After application exits, I opened a word document and CTRL-V, there is
nothing to be pasted.
 

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