Hi, I have looked at this again and it seems that the MACRO is generating the form (with multiple fields) question is, can someone tell if this code (below) is hand written or has been generated through a wizard in Word (if its the latter, can someone tell me which wizard?) MANY thanks!
Code:
Public Sub MAIN()
Dim Displayed
Dim AcNo$
Dim add1$
Dim add2$
Dim add3$
Dim add4$
Dim Name_$
Dim Title$
Dim Clerk$
Dim Atext1$
Dim Atext2$
Dim Atext3$
Dim Atext4$
Dim Atext5$
Dim A1$
Dim A2$
Dim A3$
Dim A4$
Dim A5$
Dim Test$
'Note ammendments made to add 3rd address line 09/07/97 by PKS
On Error GoTo -1: 'On Error GoTo ErrorHandler
WordBasic.BeginDialog 426, 342, "Input Customer Details"
WordBasic.GroupBox 10, 6, 405, 288, "Please Enter "
WordBasic.Text 152, 197, 35, 13, "Text", "Text16"
WordBasic.Text 23, 173, 76, 13, "Address 3", "Text17"
WordBasic.Text 164, 263, 21, 13, "#1", "Text11"
WordBasic.Text 218, 263, 21, 13, "#2", "Text12"
WordBasic.Text 270, 263, 21, 13, "#3", "Text13"
WordBasic.Text 324, 263, 21, 13, "#4", "Text14"
WordBasic.Text 376, 263, 21, 13, "#5", "Text15"
WordBasic.Text 204, 278, 156, 13, "Insert 4 digit number", "Text10"
WordBasic.Text 24, 218, 40, 18, "Clerk", "Text6"
WordBasic.Text 24, 241, 112, 18, "Para Selection", "Text8"
WordBasic.Text 23, 35, 96, 13, "Account No.", "Text5"
WordBasic.Text 23, 59, 35, 18, "Title", "Text4"
WordBasic.Text 23, 81, 75, 18, "Forename", "Text1"
WordBasic.Text 23, 104, 67, 18, "Surname", "Text2"
WordBasic.Text 23, 127, 67, 18, "Address ", "Text7"
WordBasic.Text 23, 150, 76, 18, "Address2 ", "Text9"
WordBasic.Text 24, 196, 84, 18, "Post Code ", "Text3"
WordBasic.TextBox 150, 35, 170, 18, "AccountNo"
WordBasic.TextBox 150, 58, 46, 18, "Title" 'Title
WordBasic.TextBox 150, 81, 170, 18, "FNAME"
WordBasic.TextBox 150, 104, 170, 18, "SNAME"
WordBasic.TextBox 150, 127, 222, 18, "ADD1" 'Street Name
WordBasic.TextBox 150, 150, 222, 18, "ADD2" 'Town
WordBasic.TextBox 150, 173, 222, 18, "ADD3" '3rd Address Line
WordBasic.TextBox 151, 196, 222, 18, "ADD4" 'Post Code
WordBasic.TextBox 151, 218, 170, 18, "Clerk" 'Author / Typist
WordBasic.TextBox 151, 241, 48, 18, "Atext1"
WordBasic.TextBox 205, 241, 48, 18, "Atext2"
WordBasic.TextBox 257, 241, 48, 18, "Atext3"
WordBasic.TextBox 309, 241, 48, 18, "Atext4"
WordBasic.TextBox 361, 241, 48, 18, "Atext5"
WordBasic.OKButton 51, 304, 149, 31
WordBasic.CancelButton 227, 305, 149, 31
WordBasic.EndDialog
Dim Dlg As Object: Set Dlg = WordBasic.CurValues.UserDialog
Dlg.Clerk = ""
Dlg.Title = ""
Dlg.add4 = ""
Dlg.add3 = ""
Dlg.add2 = ""
Dlg.add1 = ""
Dlg.SNAME = ""
Dlg.FNAME = ""
Dlg.AccountNo = ""
Displayed = 1
DisplayDialog:
On Error GoTo -1: On Error GoTo Bye
WordBasic.Dialog.UserDialog Dlg
On Error GoTo -1: On Error GoTo 0
'*************************************************
'Assign bookmark fields with contents of form
'*************************************************
AcNo$ = Dlg.AccountNo
add1$ = Dlg.add1
add2$ = Dlg.add2
add3$ = Dlg.add3
add4$ = Dlg.add4
Name_$ = Dlg.Title + " " + Dlg.FNAME + " " + Dlg.SNAME
Title$ = Dlg.Title + " " + Dlg.SNAME
Clerk$ = Dlg.Clerk
Atext1$ = Dlg.Atext1
Atext2$ = Dlg.Atext2
Atext3$ = Dlg.Atext3
Atext4$ = Dlg.Atext4
Atext5$ = Dlg.Atext5
' ****************************************************
' Error Checks AutoText Variable for Null Values, Get corresponding
' AutoText for all ATEXT Variables. Unknown AutoText variables are
' error trapped.
' ****************************************************
If Atext1$ = "" Then GoTo atxt2
A1$ = WordBasic.[GetAutoText$](Atext1$, 1)
If A1$ = "" Then GoTo Error1
atxt2:
If Atext2$ = "" Then GoTo atxt3
A2$ = WordBasic.[GetAutoText$](Atext2$, 1)
If A2$ = "" Then GoTo Error2
atxt3:
If Atext3$ = "" Then GoTo atxt4
A3$ = WordBasic.[GetAutoText$](Atext3$, 1)
If A3$ = "" Then GoTo Error3
atxt4:
If Atext4$ = "" Then GoTo atxt5
A4$ = WordBasic.[GetAutoText$](Atext4$, 1)
If A4$ = "" Then GoTo Error4
atxt5:
If Atext5$ = "" Then GoTo Clerk_
A5$ = WordBasic.[GetAutoText$](Atext5$, 1)
If A5$ = "" Then GoTo Error5
Clerk_:
Rem MsgBox "clerk=" + clerk$
If Clerk$ = "" Then
Test$ = WordBasic.[GetAutoText$]("990", 1)
Rem MsgBox test$
Else
Test$ = WordBasic.[GetAutoText$]("991", 1)
Rem MsgBox test$
End If
AddText:
' **************************************************
' Move Captured Address Data to Bookmark Locations
' **************************************************
WordBasic.WW7_EditGoTo Destination:="add1"
WordBasic.Insert add1$
WordBasic.WW7_EditGoTo Destination:="add2"
WordBasic.Insert add2$
WordBasic.WW7_EditGoTo Destination:="add3"
WordBasic.Insert add3$
WordBasic.WW7_EditGoTo Destination:="add4"
WordBasic.Insert add4$
WordBasic.WW7_EditGoTo Destination:="Name"
WordBasic.Insert Name_$
WordBasic.WW7_EditGoTo Destination:="Salutation"
WordBasic.Insert Title$
WordBasic.WW7_EditGoTo Destination:="AcNo"
WordBasic.Insert AcNo$
Rem LineDown 2
' ****************************************************
' Error Checks AutoText Variable for Null Values, Get corresponding
' AutoText and Inserts Paragraph then returns twice. Null AutoText
' variables are ignored and pass too the next autotext variable.
' error trapped.
' ****************************************************
If Test$ <> "" Then
WordBasic.WW7_EditGoTo Destination:="LetterEnd"
WordBasic.Insert Test$
WordBasic.LineUp 1
WordBasic.Insert Clerk$
Else
WordBasic.WW7_EditGoTo Destination:="LetterEnd"
WordBasic.Insert Test$
End If
WordBasic.WW7_EditGoTo Destination:="AcNo"
WordBasic.LineDown 2
WordBasic.StartOfLine
If A1$ <> "" Then
WordBasic.Insert A1$
WordBasic.InsertPara
End If
If A2$ <> "" Then
WordBasic.Insert A2$
WordBasic.InsertPara
End If
If A3$ <> "" Then
WordBasic.Insert A3$
WordBasic.InsertPara
End If
If A4$ <> "" Then
WordBasic.Insert A4$
WordBasic.InsertPara
End If
If A5$ <> "" Then
WordBasic.Insert A5$
WordBasic.InsertPara
WordBasic.InsertPara
End If
GoTo Bye
' ***************************************************************
'Error Handling Routine
' ***************************************************************
Error1: WordBasic.MsgBox "Invalid Paragraph No, Input Correct Paragraph No.", "ERROR IN PARAGRAPH BOX #1", 48
GoTo DisplayDialog
Error2: WordBasic.MsgBox "Invalid Paragraph No, Input Correct Paragraph No.", "ERROR IN PARAGRAPH BOX #2", 48
GoTo DisplayDialog
Error3: WordBasic.MsgBox "Invalid Paragraph No, Input Correct Paragraph No.", "ERROR IN PARAGRAPH BOX #3", 48
GoTo DisplayDialog
Error4: WordBasic.MsgBox "Invalid Paragraph No, Input Correct Paragraph No.", "Error In Paragraph Box #4", 48
GoTo DisplayDialog
Error5: WordBasic.MsgBox "Invalid Paragraph No, Input Correct Paragraph No.", "ERROR IN PARAGRAPH BOX #5", 48
GoTo DisplayDialog
Bye:
WordBasic.MsgBox "Ammendments can now be made, all (INSERTS) are to be filled manually", "Correspondence Standard Letters", 48
End Sub