ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Picture Into Form (https://www.excelbanter.com/excel-programming/392245-insert-picture-into-form.html)

[email protected]

Insert Picture Into Form
 
I have never used excel before. I need to make a form with a box. When
you click on the box it should ask if you want to add a picture to the
box. It should also format the picture so that it is the same size as
the box. Can this be done in excel or do I have to use another
application for this?


[email protected]

Insert Picture Into Form
 
I really need to find the answer to my question so please post a
response if you have any idea of how this can be done.



Susan

Insert Picture Into Form
 
you can use excel for this but if you've never even used excel before,
it's going to be awfully difficult to explain & implement............
susan


On Jun 28, 12:25 pm, wrote:
I really need to find the answer to my question so please post a
response if you have any idea of how this can be done.




Susan

Insert Picture Into Form
 
what is the purpose of this, anyway??????
what's the good of a user putting a picture on the form? he can't
utilize it then. he can't print it. it's really just an
exercise...........
sounds like homework - we don't do homework for people in this
newsgroup.

try searching:

userform
open file
picture on userform

susan


On Jun 28, 12:25 pm, wrote:
I really need to find the answer to my question so please post a
response if you have any idea of how this can be done.




[email protected]

Insert Picture Into Form
 
Its not homework. Its something I am doing for my boss. I dont' have
any experience with access but some of the other people I work with
do. If you know how to do this please post it.


Peter T

Insert Picture Into Form
 
If you have never used Excel or VBA before I'm afraid you will have at least
a some learning to do before you are likely to get any more answers.

This might get you started -

Add an image control named Image1 to a Userform
You may need to do some research if you're not sure how to do that.

Add the following code to the userform module

Private Sub Image1_Click()
Dim vFile
Dim sFilter As String
Dim wd As Single, ht As Single

sFilter = "Picture Files,*.jpg;*.bmp;*.gif"
vFile = Application.GetOpenFilename(sFilter)

If vFile = False Then Exit Sub
On Error GoTo errH

With Me.Image1
.AutoSize = True
.Left = 0 ' comment if you don't want to move the image
.Top = 0
.Picture = LoadPicture(vFile)
wd = .Width
ht = .Height
End With

'delete form resize stuff if not required
Me.Top = 0
Me.Left = 0
Me.Width = wd + (Me.Width - Me.InsideWidth)
Me.Height = ht + (Me.Height - Me.InsideHeight)

'but keep this
AppActivate Me.Caption
Exit Sub
errH:
MsgBox Err.Description
End Sub

Run the form and click the image control

Regards,
Peter T

wrote in message
ups.com...
I have never used excel before. I need to make a form with a box. When
you click on the box it should ask if you want to add a picture to the
box. It should also format the picture so that it is the same size as
the box. Can this be done in excel or do I have to use another
application for this?





All times are GMT +1. The time now is 12:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com