Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help please- user selectable image
I posted a message and everyone bypassed it. I know I ask
for a lot, but I am stuck. If you can't help, can you direct me to someone who can? please. I have a workbook that I need to have a image imported from a users local machine. The workbook is protected, but I would like them to be able to click(or double) a sized cell and have a .jpg photo from their machine fit to size in the box keeping aspect ratio of the image, and making the background of the unused cell(or imagebox whichever is better) white. The image has to be able to print, and the sheet has to remain protected. I want to save this as a template, that has no image in the box when opened. Any more information needed to help get an answer, I will provide. Regnar |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help please- user selectable image
Probably far from foolproof, but this should get you started. You can either
unprotect and reprotect the worksheet by providing the password in your code, or set the protection to UserInterfaceOnly which will allow macros to work: Sub InsertAndSize() Dim c As Range, AR As Double Set c = ActiveCell ActiveSheet.Unprotect "MyPassword" If Application.Dialogs(xlDialogInsertPicture).Show = False Then Exit Sub Else With Selection AR = .Height / .Width .Top = c.Top .Left = c.Left If c.Height / c.Width = AR Then .Width = c.Width .Height = .Width * AR .Left = c.Left .Top = c.Top + (c.Height - .Height) / 2 Else .Height = c.Height .Width = .Height / AR .Top = c.Top .Left = c.Left + (c.Width - .Width) / 2 End If End With End If ActiveCell.Select ActiveSheet.Protect "MyPassword" End Sub Note that the correct cell will need to be selected. Otherwise, you can explicitly define the cell in which you want the picture contained. -- Vasant "Regnar" wrote in message ... I posted a message and everyone bypassed it. I know I ask for a lot, but I am stuck. If you can't help, can you direct me to someone who can? please. I have a workbook that I need to have a image imported from a users local machine. The workbook is protected, but I would like them to be able to click(or double) a sized cell and have a .jpg photo from their machine fit to size in the box keeping aspect ratio of the image, and making the background of the unused cell(or imagebox whichever is better) white. The image has to be able to print, and the sheet has to remain protected. I want to save this as a template, that has no image in the box when opened. Any more information needed to help get an answer, I will provide. Regnar |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
User Selectable Series and Number of Series for Line Chart | Charts and Charting in Excel | |||
Selectable Criteria | Charts and Charting in Excel | |||
Hyperlink to an image in other worksheet, displaying entire image. | Excel Worksheet Functions | |||
How do I make a line non-selectable? | Excel Discussion (Misc queries) | |||
Export the worksheet background image as an image file - possible? | Excel Programming |