Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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
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
User Selectable Series and Number of Series for Line Chart Dave in NJ Charts and Charting in Excel 2 February 23rd 09 12:18 AM
Selectable Criteria GoodTrouble Charts and Charting in Excel 7 January 23rd 08 09:11 PM
Hyperlink to an image in other worksheet, displaying entire image. twilliams Excel Worksheet Functions 0 February 7th 06 10:02 PM
How do I make a line non-selectable? Shinka Excel Discussion (Misc queries) 4 October 5th 05 09:25 PM
Export the worksheet background image as an image file - possible? DataFreakFromUtah Excel Programming 2 April 10th 04 04:49 PM


All times are GMT +1. The time now is 05:38 AM.

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

About Us

"It's about Microsoft Excel"