Consulting

Results 1 to 5 of 5

Thread: Solved: Sheet Protection and Clipboard

  1. #1

    Question Solved: Sheet Protection and Clipboard

    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?

    Thanks
    Feedback is the best way for me to learn


    Follow the Armies

  2. #2
    VBAX Regular
    Joined
    Dec 2007
    Posts
    21
    Location
    You may need to use the Windows clipboard http://www.cpearson.com/excel/clipboard.aspx

  3. #3
    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.
    Feedback is the best way for me to learn


    Follow the Armies

  4. #4
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    269
    Location
    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...

    [vba]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
    [/vba]

  5. #5
    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.
    Feedback is the best way for me to learn


    Follow the Armies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •