Sub autoadd()
'
' autoadd Macro
' Macro opgenomen op 23-11-2004 door E. Holman
'
'If BuildKeyCode(wdKeyControl, _
'wdKeyShift, wdKeyTab) = 777 Then
'MsgBox "Shift tab ingedrukt", vbCritical
'End If
ActiveDocument.Unprotect
Selection.MoveRight Unit:=wdCell
Selection.FormFields.Add Range:=Selection.Range, Type:= _
wdFieldFormTextInput
Selection.MoveRight Unit:=wdCell
Selection.FormFields.Add Range:=Selection.Range, Type:= _
wdFieldFormTextInput
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.FormFields(1)
.EntryMacro = ""
.ExitMacro = ""
.Enabled = True
.OwnHelp = False
.HelpText = ""
.OwnStatus = False
.StatusText = ""
With .TextInput
.EditType Type:=wdNumberText, Default:="", Format:=""
.Width = 0
End With
End With
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="€ "
Selection.FormFields.Add Range:=Selection.Range, Type:= _
wdFieldFormTextInput
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.FormFields(1)
.EntryMacro = ""
.ExitMacro = "autoadd"
.Enabled = True
.OwnHelp = False
.HelpText = ""
.OwnStatus = False
.StatusText = ""
With .TextInput
.EditType Type:=wdNumberText, Default:="", Format:="0,00"
.Width = 0
End With
End With
'Count all the input fields
'
For Each aField In ActiveDocument.FormFields
If aField.Type = wdFieldFormTextInput Then Count = Count + 1
Next aField
'Select the first field of the row
'
ActiveDocument.FormFields(Count - 1).Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub