Answer box....where am i going wrong.

M

mrodwell

Hi all, please find my code below....when i click on my Next button it
tells me variable not dounf and highlights the answer part....i don't
understand why this has happened...please could someone help.

rivate Sub nxtbut_Click()

Selection.TypeText datetxt
Selection.MoveRight Unit:=wdCell
Selection.TypeText wktxt
Selection.MoveDown Unit:=wdCell
Selection.MoveLeft Unit:=wdCell

'Training selection'
nSel1 = -int1 * 1 - Ext1 * 2 - Del1 * 3 - Rec1 * 4

With ActiveDocument.FormFields
Select Case nSel1
Case 1
.Item("Check9").CheckBox.Value = True
.Item("Check10").CheckBox.Value = False
.Item("Check11").CheckBox.Value = False
.Item("Check12").CheckBox.Value = False
Case 2
.Item("Check9").CheckBox.Value = False
.Item("Check10").CheckBox.Value = True
.Item("Check11").CheckBox.Value = False
.Item("Check12").CheckBox.Value = False
Case 3
.Item("Check9").CheckBox.Value = False
.Item("Check10").CheckBox.Value = False
.Item("Check11").CheckBox.Value = True
.Item("Check12").CheckBox.Value = False
Case 4
.Item("Check9").CheckBox.Value = False
.Item("Check10").CheckBox.Value = False
.Item("Check11").CheckBox.Value = False
.Item("Check12").CheckBox.Value = True
End Select
End With


'need to sort out tick boxes.

Q3bfrm.Hide
Unload Q3bfrm


Answer = MsgBox("Details of Training Courses?", vbYesNo + vbQuestion,
"Add another?")
If Answer = vbYes Then 'If Yes
Q3cfrm.Show 'Display dialog box again
Else
Selection.GoTo What:=wdGoToBookmark, Name:="b3date"
Q4frm.Show
Q3bfrm.Hide
Unload Q3bfrm
End If
End Sub
 
E

Ed

I don't see where you have any variables declared. When I put your "Answer=
etc." into my module, it worked fine - after I declared a variable named
"Answer".

Ed
 

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