ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to restore previous content of clipboard (https://www.excelbanter.com/excel-programming/448327-macro-restore-previous-content-clipboard.html)

Fan924

Macro to restore previous content of clipboard
 
I have a macro that executes several copy and pastes. The problem, If I copy something then run the macro, I have lost the original copied item. ;{

I would like to enter the macro, store the clipboard content and later exit the macro restoring the clipboard. Any ideas? Thanks. I am using excel 2000.

Fan924

Macro to restore previous content of clipboard
 
What I do now is to clear the clipboard before exiting macro with this
Application.CutCopyMode = False

isabelle

Macro to restore previous content of clipboard
 
hi Fan924,

'add a reference to the Microsoft Forms 2.0 Object Library

Sub Macro1()
Dim DataObj As New MSForms.DataObject
Dim S As String
DataObj.GetFromClipboard
S = DataObj.GetText
Debug.Print S
End Sub

isabelle

Le 2013-03-05 21:32, Fan924 a écrit :
What I do now is to clear the clipboard before exiting macro with this
Application.CutCopyMode = False


Fan924

Macro to restore previous content of clipboard
 
isabelle, Thanks


All times are GMT +1. The time now is 01:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com