User Form (Inserting a Picture)

leadx

Board Regular
Joined
Oct 24, 2004
Messages
93
I'm looking to use a user form to insert a picture into excel.

The picture area would be 2" x 2", but a user would able to enter a smaller picture.

So... I'm wondering if this is even possible and how the heck you'd code something like this... my vba skills are still in the elementary stage. :)

Thanks in advance,

Corey
 
Thanks Alan...

I appreciate any help... I've been struggling with this for countless hours. Yikes.

Corey
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hey Alan... I don't know if you're still out there... but if you were able to come up with something for me... I'd really appreciate it. :)

If not... Is there anyone out there that can help me insert this a picture from a form into a worksheet?
 
Upvote 0
Hi Corey,

Sorry about that - got a little delayed I got into work and guesswhat? they expected me to actually DO something ;¬)

Assuming that the filename of the required picture is in vFilename, try:

Range("C9").select
ActiveSheet.Pictures.Insert( vFileName)
 
Upvote 0
Hey Alan,

Thanks again for your help...

Unfortunately that code doesn't seem to work. I get a run time error?

Here's the full code I've been using for a click on "ok"

Code:
Private Sub cmdOk_Click()
    'unprotect sheet
    ws.Unprotect "123456"
 
    Range("C9").Select
    ActiveSheet.Pictures.Insert (vFileName)

    'protect sheet
    ws.Protect "123456"
   'if close is checked then close form
   If ckClose.Value Then
         Close form
        Me.Hide
    End If
End Sub

I hate to take so much of your time on this... I'm beginning to think this just might not be possible to do. ugh
 
Upvote 0
Morning Corey what's the storey ;¬)

The variable vFileName needs to contain a valid full-path filename.

So if, for instance, you declared vFileName at the top of your userform (AFTER 'Option Explicit' if present), it will be 'in scope' for the OK button code.
 
Upvote 0

Forum statistics

Threads
1,224,802
Messages
6,181,054
Members
453,014
Latest member
Chris258

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top