Getting information from a radio button form

TychaBrahe

New Member
Joined
Dec 23, 2014
Messages
1
I have a script. One of the lines of the script current reads

InsertLogo "c:\poet\ebp.jpg"

This passes the name of a graphic to a sub that inserts that graphic into a spreadsheet.

What I want to do is popup a form with two radioboxes. The selection of the radioboxes controls which graphic is inserted into the form. What I have so far is

Dim GraphicChoice
Load frmGraphicChoice
frmGraphicChoice.Show

InsertLogo "c:\poet\" & GraphicChoice
Unload frmGraphicChoice

The popup has this code.

Private Sub CommandButton1_Click()
Unload Me
End Sub


Private Sub OptionButton1_Click()
GraphicChoice = "ebp.jpg"
End Sub


Private Sub OptionButton2_Click()
GraphicChoice = "dsc.jpg"
End Sub

This isn't working. Any suggestions?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You are missing the code to insert the picture.

Code:
Private Sub CommandButton1_Click()
Dim Pix As Picture
dim MyPath as string

Mypath = "C:\My Documents\"
    Set Pix = ActiveSheet.Pictures.Insert(MyPath & GraphicChoice)
    With Pix
        'Position the picture
        'Change the cell range as required.
        .Top = Range("D10").Top
        .Left = Range("D10").Left
    End With

        Unload Me
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,759
Messages
6,132,551
Members
449,735
Latest member
Gary_M

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