cmdOK click command and Options

S

Sophie

I have 2 problems

1. I have created a cmdOK click button but am having problems with the code
that I have to put in so that when that button is clicked the userform closes.

2. I have option buttons on the userform. when I click on OptionButton1
the code works. When I click on OptionButton2 the code does not work
 
J

John Wilson

Sophie - please take this the way its meant as advice!!!

"I have some code you cant see and it doesnt work, so whats wrong?" is what
your asking!

maybe post the code so we can see it will help.

_____________________________
John Wilson
Microsoft Certified Office Specialist
 
S

Sophie

Hi John here is the code you requested:

Any assistance would be great

Private Sub cmdOK_Click()

If OptionButton1 = True Then
ActiveWindow.ViewType = ppViewSlideMaster
ActivePresentation.SlideMaster.Shapes("Rectangle 145").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select

ActivePresentation.SlideMaster.Shapes.AddPicture(FileName:="\\TACTICSMEL-1\DATA\Projects\Transurban\06
2630 Corporate template\Highly Confidential.jpg", LinkToFile:=msoFalse,
SaveWithDocument:=msoTrue, Left:=234, Top:=252, Width:=253, Height:=37).Select
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 0.69, msoFalse, msoScaleFromBottomRight
.ScaleHeight 0.69, msoFalse, msoScaleFromBottomRight
End With
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 0.72, msoFalse, msoScaleFromBottomRight
.ScaleHeight 0.72, msoFalse, msoScaleFromBottomRight
End With
With ActiveWindow.Selection.ShapeRange
.IncrementLeft -177.38
.IncrementTop 225.38
End With

End If

If OptionButton2 = True Then
ActiveWindow.ViewType = ppViewSlideMaster
ActivePresentation.SlideMaster.Shapes("Rectangle 145").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select

ActivePresentation.SlideMaster.Shapes.AddPicture(FileName:="\\TACTICSMEL-1\DATA\Projects\Transurban\06
2630 Corporate template\Commercial in Confidence.jpg", LinkToFile:=msoFalse,
SaveWithDocument:=msoTrue, Left:=234, Top:=252, Width:=253, Height:=37).Select
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 0.69, msoFalse, msoScaleFromBottomRight
.ScaleHeight 0.69, msoFalse, msoScaleFromBottomRight
End With
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 0.72, msoFalse, msoScaleFromBottomRight
.ScaleHeight 0.72, msoFalse, msoScaleFromBottomRight
End With
With ActiveWindow.Selection.ShapeRange
.IncrementLeft -177.38
.IncrementTop 225.38
End With

End If

If OptionButton3 = True Then
ActiveWindow.ViewType = ppViewSlideMaster
ActivePresentation.SlideMaster.Shapes("Rectangle 145").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select

ActivePresentation.SlideMaster.Shapes.AddPicture(FileName:="\\TACTICSMEL-1\DATA\Projects\Transurban\06
2630 Corporate template\Company Confidential.jpg", LinkToFile:=msoFalse,
SaveWithDocument:=msoTrue, Left:=234, Top:=252, Width:=253, Height:=37).Select
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 0.69, msoFalse, msoScaleFromBottomRight
.ScaleHeight 0.69, msoFalse, msoScaleFromBottomRight
End With
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 0.72, msoFalse, msoScaleFromBottomRight
.ScaleHeight 0.72, msoFalse, msoScaleFromBottomRight
End With
With ActiveWindow.Selection.ShapeRange
.IncrementLeft -177.38
.IncrementTop 225.38
End With

End If

If OptionButton4 = True Then
ActiveWindow.ViewType = ppViewSlideMaster
ActivePresentation.SlideMaster.Shapes("Rectangle 145").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select

ActivePresentation.SlideMaster.Shapes.AddPicture(FileName:="\\TACTICSMEL-1\DATA\Projects\Transurban\06
2630 Corporate template\Public.jpg", LinkToFile:=msoFalse,
SaveWithDocument:=msoTrue, Left:=234, Top:=252, Width:=253, Height:=37).Select
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 0.69, msoFalse, msoScaleFromBottomRight
.ScaleHeight 0.69, msoFalse, msoScaleFromBottomRight
End With
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 0.72, msoFalse, msoScaleFromBottomRight
.ScaleHeight 0.72, msoFalse, msoScaleFromBottomRight
End With
With ActiveWindow.Selection.ShapeRange
.IncrementLeft -177.38
.IncrementTop 225.38
End With
ActiveWindow.ViewType = ppViewNormal
End If

Me.Hide
Unload Classification

End Sub
 

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

Top