Insert Picture Into Form

  • Thread starter Thread starter ecuevas
  • Start date Start date
E

ecuevas

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?
 
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.
 
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
 
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
 
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top