Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default I want to insert a picture in an unlocked cell of a protected shee

I want to insert a picture in an unlocked cell of a protected sheet. How do
I do that?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 353
Default I want to insert a picture in an unlocked cell of a protected shee

You can't. Pictures don't go in cells, they are objects over the sheet and a
protected sheet, by default, does not allow the addition of objects.

"DiamondDave44" wrote:

I want to insert a picture in an unlocked cell of a protected sheet. How do
I do that?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 747
Default I want to insert a picture in an unlocked cell of a protected shee

Try something like this:

Const FileTypes As String = "Picture files (*.bmp; *.gif; *.tif; " & _
"*.jpg; *.jpeg), *.bmp; *.gif; *.tif; *.jpg; *.jpeg"

Sub InsertPict()
Dim ws As Worksheet
Dim P As Picture
Dim c As Range
Dim h As Single, r As Single
Dim PNm As Variant

Set ws = ActiveSheet 'Sheets("Pictures")
ws.Unprotect
Set c = ws.Range("B2")
With Application
PNm = .GetOpenFilename(FileTypes, Title:="Select Photo")
If VarType(PNm) = vbBoolean Then Exit Sub
.ScreenUpdating = False
Set P = ws.Pictures.Insert(PNm)
r = P.Height / P.Width 'Get proportionality ratio
P.Width = c.Width
P.Height = r * P.Width
P.Left = c.Left
P.Top = c.Top
c.RowHeight = P.Height
.ScreenUpdating = True
End With
ws.Protect
Set ws = Nothing
Set P = Nothing
Set c = Nothing
End Sub


Regards,
Greg

"DiamondDave44" wrote:

I want to insert a picture in an unlocked cell of a protected sheet. How do
I do that?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I allow insert picture in sheet when it is protected Darshan Excel Discussion (Misc queries) 0 March 10th 07 11:55 AM
insert picture into protected sheet justlearnin Excel Discussion (Misc queries) 0 October 2nd 06 04:25 PM
How can I insert the tab name into a cell in a different shee... prumble Excel Discussion (Misc queries) 1 July 5th 06 05:26 PM
How do I insert a comment in unlocked cell of a protected workshee TD_Anne Excel Worksheet Functions 2 January 16th 06 07:27 PM
How can I insert a picture from file while worksheet is protected ChrisYH Excel Discussion (Misc queries) 0 July 27th 05 04:25 AM


All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"