View Full Version : Solved: Sheet Protection and Clipboard
fredlo2010
06-08-2012, 11:53 AM
Hello guys,
I have a big issue here. I just discovered the protecting and unprotecting my sheets and workbook clears up my clipboard information.
Is there a way to bypass this? :dunno
Thanks
You may need to use the Windows clipboard http://www.cpearson.com/excel/clipboard.aspx
fredlo2010
06-08-2012, 12:28 PM
I was reading it, but what If I want to put more than just one string. I need to put the values of a whole sheet on the clipboard.
Furthermore the values are not even from Excel. The user will copy them from another application and then press a button that will paste all that information in a newly created worksheet.
CodeNinja
06-08-2012, 01:53 PM
I know this might not be the exact solution you want, but why not a simple workaround... Create a temporary workbook you paste the Copied Data to, then you can unprotect, copy from the temporary file, then paste into the workbook then re-protect it...
Sub test()
Dim wb2 As Workbook
Set newbook = Workbooks.Add
With newbook
.Title = "Temp"
.Subject = "TempBook"
.SaveAs Filename:="TempWorkbook"
End With
Set wb2 = Workbooks.Open(Filename:="TempWorkbook")
ThisWorkbook.Sheets(1).Activate
ActiveSheet.Cells.Select
Selection.Copy
wb2.Activate
Worksheets(1).Activate
ActiveSheet.Range("A1").Select
Selection.PasteSpecial
End Sub
fredlo2010
06-08-2012, 04:00 PM
Thank you guys,
Well I have to tell you I freaked out for no reason. Apparently Excel will delete my clipboard info only if the information comes from the same file or any workbook within Excel itself. If I copy data from lets say Internet explorer then protecting and unprotecting the workbook will not affect the clipboard.
Since my data is coming from another application then, I have no issues at all.
Thanks a lot for the help guys. I will definitively look into the matter even further.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.