Operon
01-16-2011, 01:30 PM
I am trying to build a Userform that will operate in PPT edit mode to enter text into multiple slides of a presentation.
1) There are 25 identical slides each with "Subject", "Question" and "Answer" textboxes. [Starts on Slide 4.]
2) The Userform has 5 pages each page with 11 Textboxes. The first textbox of each page is the "Subject" textbox, followed by 5 pairs of "Question" and "Answer" textboxes.
When the user clicks the form's Submit CommandButton the Userform's textboxes should populate the relevant textboxes on the presentation's slides.
The following Submit button's code of Userform is not working correctly.
Private Sub CommandButton1_Click()
Dim pPage As Integer
Dim cSlide As Integer
Dim cCnt As Long
Dim cTbox As Long
Dim tTbox As Long
cTbox = 1
tTbox = 2
cCnt = 0
pPage = 1
For cSlide = 4 To 28 Step 1
With ActivePresentation.Slides(cSlide)
.Shapes("Title1").TextFrame.TextRange.Text = Me.MultiPage1.Pages(pPage).TextBox(cTbox).Text
.Shapes("Ques1").TextFrame.TextRange.Text = Me.MultiPage1.Pages(pPage).TextBox(tTbox).Text
tTbox = tTbox + 1
.Shapes("Ans1").TextFrame.TextRange.Text = Me.MultiPage1.Pages(pPage).TextBox(tTbox).Text
End With
cCnt = cCnt + 1
If cCont > 5 Then
pPage = pPage + 1
cTbox = tTbox + 1
tTbox = tTbox + 2
cCnt = 0
Else: tTbox = tTbox + 1
End If
Next cSlide
End Sub
Any helpful suggestions gratefully appreciated.
Also, I am unsure of how best to have user load(show) userform from presentation's edit mode. Perhaps an ActiveX command button?
Many thanks in advance.
Cheers,
John
1) There are 25 identical slides each with "Subject", "Question" and "Answer" textboxes. [Starts on Slide 4.]
2) The Userform has 5 pages each page with 11 Textboxes. The first textbox of each page is the "Subject" textbox, followed by 5 pairs of "Question" and "Answer" textboxes.
When the user clicks the form's Submit CommandButton the Userform's textboxes should populate the relevant textboxes on the presentation's slides.
The following Submit button's code of Userform is not working correctly.
Private Sub CommandButton1_Click()
Dim pPage As Integer
Dim cSlide As Integer
Dim cCnt As Long
Dim cTbox As Long
Dim tTbox As Long
cTbox = 1
tTbox = 2
cCnt = 0
pPage = 1
For cSlide = 4 To 28 Step 1
With ActivePresentation.Slides(cSlide)
.Shapes("Title1").TextFrame.TextRange.Text = Me.MultiPage1.Pages(pPage).TextBox(cTbox).Text
.Shapes("Ques1").TextFrame.TextRange.Text = Me.MultiPage1.Pages(pPage).TextBox(tTbox).Text
tTbox = tTbox + 1
.Shapes("Ans1").TextFrame.TextRange.Text = Me.MultiPage1.Pages(pPage).TextBox(tTbox).Text
End With
cCnt = cCnt + 1
If cCont > 5 Then
pPage = pPage + 1
cTbox = tTbox + 1
tTbox = tTbox + 2
cCnt = 0
Else: tTbox = tTbox + 1
End If
Next cSlide
End Sub
Any helpful suggestions gratefully appreciated.
Also, I am unsure of how best to have user load(show) userform from presentation's edit mode. Perhaps an ActiveX command button?
Many thanks in advance.
Cheers,
John