Using the camera tool when objects are locked

PK_1

New Member
Joined
May 26, 2023
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
I have a simple sheet setup for computer specs that has a column of icons in column A, the spec type in column B (screen size, GPU, HDD etc), and the value in column 3.
I want to lock columns A and B and all the icons, and leave C editable, so I select those cells/pictures to be locked and then protect the worksheet.

The problem I'm having is that if I don't choose "Edit objects" in the protect worksheet options the camera tool is greyed out and unusable. I want users to be able to edit the fields in column c, and then be able to create a snap using the camera tool of the whole table, but obviously i don't want them accidentally clicking on or moving the icons.

Any ideas?

1685096317656.png
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Might you post a link to the workbook so someone willing to assist doe not have to create one with fake data, unlikely. Use the link icon above the message area. Put the file on 1drive, dropbox, etc.
 
Upvote 0
I'm not exactly sure what is needed but maybe this 'll help. The test workbook is not password protected. You can password protect but you'll have to specify the password in the code. Let me know if it works for you.

The test workbook is HERE.

VBA Code:
Option Explicit

Sub MakePictureOfUserRange()

    Dim wsData As Worksheet
    
 '  Range object that points to the cells selected by the user.
    Dim rUserSelection As Range
    
'   Range object points to the cell where the picture is placed.
    Dim rOutput As Range
    
    Dim sPictureName As String
    
    Dim bProtectStatus As Boolean
    
    Dim sPassword As String
    
    Set wsData = ThisWorkbook.Worksheets("Sheet1") '<= specify the sheet name here.
    
'   Protection password if one is used.
    sPassword = ""
    
    On Error Resume Next
    Set rUserSelection = Selection
    On Error GoTo 0
    
'   If the selection is not a range then tell user and exit sub
    If rUserSelection Is Nothing _
     Then
        MsgBox "Please select cells to make a picture of.", vbExclamation, "Making the picture."
        Exit Sub
    End If

'   If the selection is one cell or empty then tell user and exit sub
    If rUserSelection.Cells.Count = 1 Or rUserSelection.Cells(1).Value = "" _
     Then
        MsgBox "Please select cells to make a picture of.", vbExclamation, "Making the picture."
        Exit Sub
    End If
    
'   Set the range where the picture will be placed.
    'Set rOutput = wsData.Range("E2") '<= use this to specif a specific cell
    
'   Set output range = two cells over from the data selected.
    Set rOutput = rUserSelection.Cells(1).Offset(0, 2)
    
'   Specify the name of the picture.
    sPictureName = "User Selection"
    
'   Determine if the worksheet is protected. Save the status.
    bProtectStatus = wsData.ProtectContents
    
'   Unprotect the worksheet.
    'wsData.Unprotect '<= if there is no password for protection
    
    wsData.Unprotect Password:=sPassword
    
'   Make the picture.
    Call DoCamera(rUserSelection, rOutput, sPictureName)
    
'   Leave user next to where the picture was placed.
    rOutput.Offset(0, -1).Activate
    
'   If the worksheet is protected then reprotect it.
    If bProtectStatus Then wsData.Protect Password:=sPassword, Userinterfaceonly:=True

End Sub


Sub DoCamera(prUserSelection As Range, prOutput As Range, psPictureName As String)

    Dim wsPicture As Worksheet
    
    Set wsPicture = prUserSelection.Parent
        
'   Delete the picture if it already exists.
    On Error Resume Next
    wsPicture.Shapes.Range(Array(psPictureName)).Delete
    On Error GoTo 0

'   Copy user selection range.
    prUserSelection.CopyPicture
    
'   put the picture into the output range (cell).
    prOutput.PasteSpecial
    
'   Tell picture what range it is showing by setting its
'   formula to the address of the user selection range.
    Selection.Formula = prUserSelection.Address
    
'   Give name to the picture.
    Selection.Name = psPictureName
    
'   Picture is not locked.
    Selection.Locked = msoFalse

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top