PDA

View Full Version : [SOLVED:] Popup box text field then Ok to appear as text box on current slide



RayKay
07-30-2019, 06:22 AM
24709
Hi John

I'm a bit stumped, tried myself, and searched, but no luck.

I need a Macro that pops up a small text box a person can type into. They click OK and the text is transferred to a bordered text box on that current slide in the top right corner (i.e. word wrapped).

Any ideas please? Many thanks :)

RayKay
08-07-2019, 12:27 AM
Sorry, forgot to mention, after the text is typed into the popup box, it then creates the text box with the text included, on the slide.
Thanks :)

John Wilson
08-07-2019, 01:20 AM
To get that exact layout you would have to create a custom UserForm. You can get a similar effect with a much easier InputBox.

To get that border you would have to use a single cell table. Here's a start (I'm on holiday from Today)


Sub Add_Text()
Dim strText As String
Dim osld As Slide
strText = InputBox("Enter Text")
'NOTE THIS WILL NOT WORK IN SHOW MODE
Set osld = ActiveWindow.Selection.SlideRange(1)
With osld.Shapes.AddTable(1, 1)
With .Table.Cell(1, 1)
.Shape.Fill.Visible = False
.Shape.TextFrame.TextRange = strText
.Shape.TextFrame.TextRange.Font.Color.RGB = vbBlack
With .Borders(ppBorderTop)
.Visible = True
.Weight = 2
.ForeColor.RGB = vbBlack
End With
With .Borders(ppBorderBottom)
.Visible = True
.Weight = 2
.ForeColor.RGB = vbBlack
End With
End With
.Width = 200
.Left = 10
.Top = 10
End With
End Sub

RayKay
08-07-2019, 08:57 AM
Thanks John, that's PERFECT !!!
You star! Have a great vacation :thumb