L
Louis
Word 2002
I need to sum a group of 8 text form fields automatically in a macro, put
the total in the total box, then transfer the total to a second field.
I cant seem to do this.
The form uses a Tab Order macro on exiting each field so the calculate on
exit option does not trigger. Unfortunately the tab order macro is
necessary due to the design of the form.
Below is a copy of the macro.
I need to total the fields txtcharge1 through txtcharge8 and put the total
in the field txttotalcharges.
I then need to copy the contents of txttotalcharges to the field
txttotalchargesdue.
Can someone let me know How I can do this? And where in the macro would I
put this? I would imagine when I am in the field txtcharge8 before I tab to
txttotalcharges, or would I put it in txttotalcharges when I enter the
field?
can anyone help?
Thanks
Lou
++++++++++++++++++++++++++++++++++++
Option Explicit
Sub TabOrder()
'
' TabOrder Macro
' Macro recorded 7/2/2003
Dim sTabTo As String
Dim dlgForm As Dialog
Set dlgForm = Dialogs(wdDialogFormFieldOptions)
Select Case LCase(dlgForm.Name)
'Set tabs for residents.
Case "txtresident1"
sTabTo = "txtresident2"
Case "txtresident2"
sTabTo = "txtresident3"
Case "txtresident3"
sTabTo = "txtresident4"
'Set tabs to apartment number.
Case "txtresident4"
sTabTo = "txtaptnum"
'Set tabs for address.
Case "txtaptnum"
sTabTo = "txtaddress1"
Case "txtaddress1"
sTabTo = "txtaddress2"
Case "txtaddress2"
sTabTo = "txtaddress3"
Case "txtaddress3"
sTabTo = "txtaddress4"
'Set tabs address to certified mail number.
Case "txtaddress4"
sTabTo = "txtcertmailnum"
'Set tabs from certified mail number to managers.
Case "txtcertmailnum"
sTabTo = "txtmanager"
Case "txtmanager"
sTabTo = "txtassistantmanager"
'Set tabs to list of charges.
Case "txtassistantmanager"
sTabTo = "txtlistofcharges1"
Case "txtcharge1"
sTabTo = "txtlistofcharges2"
Case "txtcharge2"
sTabTo = "txtlistofcharges3"
Case "txtcharge3"
sTabTo = "txtlistofcharges4"
Case "txtcharge4"
sTabTo = "txtlistofcharges5"
Case "txtcharge5"
sTabTo = "txtlistofcharges6"
Case "txtcharge6"
sTabTo = "txtlistofcharges7"
Case "txtcharge7"
sTabTo = "txtlistofcharges8"
'Set tab to total charges for apartment.
Case "txtcharge8"
sTabTo = "txttotalcharges"
'Set tab to amount of security deposit, apartment credits and charges.
Case "txttotalcharges"
sTabTo = "txtsecuritydeposit"
Case "txtsecuritydeposit"
sTabTo = "txtinterestearned"
Case "txtinterestearned"
sTabTo = "txtliquidateddamage"
Case "txtliquidateddamage"
sTabTo = "txttotalchargesdue"
Case "txttotalchargesdue"
sTabTo = "txtbalancedue"
Case "txtbalancedue"
sTabTo = "txtrefunddue"
'Tabs to comments.
Case "txtrefunddue"
sTabTo = "txtcomment1"
Case "txtcomment1"
sTabTo = "txtcomment2"
Case "txtcomment2"
sTabTo = "txtcomment3"
Case Else
End Select
Selection.GoTo What:=wdGoToBookmark, Name:=sTabTo
End Sub
I need to sum a group of 8 text form fields automatically in a macro, put
the total in the total box, then transfer the total to a second field.
I cant seem to do this.
The form uses a Tab Order macro on exiting each field so the calculate on
exit option does not trigger. Unfortunately the tab order macro is
necessary due to the design of the form.
Below is a copy of the macro.
I need to total the fields txtcharge1 through txtcharge8 and put the total
in the field txttotalcharges.
I then need to copy the contents of txttotalcharges to the field
txttotalchargesdue.
Can someone let me know How I can do this? And where in the macro would I
put this? I would imagine when I am in the field txtcharge8 before I tab to
txttotalcharges, or would I put it in txttotalcharges when I enter the
field?
can anyone help?
Thanks
Lou
++++++++++++++++++++++++++++++++++++
Option Explicit
Sub TabOrder()
'
' TabOrder Macro
' Macro recorded 7/2/2003
Dim sTabTo As String
Dim dlgForm As Dialog
Set dlgForm = Dialogs(wdDialogFormFieldOptions)
Select Case LCase(dlgForm.Name)
'Set tabs for residents.
Case "txtresident1"
sTabTo = "txtresident2"
Case "txtresident2"
sTabTo = "txtresident3"
Case "txtresident3"
sTabTo = "txtresident4"
'Set tabs to apartment number.
Case "txtresident4"
sTabTo = "txtaptnum"
'Set tabs for address.
Case "txtaptnum"
sTabTo = "txtaddress1"
Case "txtaddress1"
sTabTo = "txtaddress2"
Case "txtaddress2"
sTabTo = "txtaddress3"
Case "txtaddress3"
sTabTo = "txtaddress4"
'Set tabs address to certified mail number.
Case "txtaddress4"
sTabTo = "txtcertmailnum"
'Set tabs from certified mail number to managers.
Case "txtcertmailnum"
sTabTo = "txtmanager"
Case "txtmanager"
sTabTo = "txtassistantmanager"
'Set tabs to list of charges.
Case "txtassistantmanager"
sTabTo = "txtlistofcharges1"
Case "txtcharge1"
sTabTo = "txtlistofcharges2"
Case "txtcharge2"
sTabTo = "txtlistofcharges3"
Case "txtcharge3"
sTabTo = "txtlistofcharges4"
Case "txtcharge4"
sTabTo = "txtlistofcharges5"
Case "txtcharge5"
sTabTo = "txtlistofcharges6"
Case "txtcharge6"
sTabTo = "txtlistofcharges7"
Case "txtcharge7"
sTabTo = "txtlistofcharges8"
'Set tab to total charges for apartment.
Case "txtcharge8"
sTabTo = "txttotalcharges"
'Set tab to amount of security deposit, apartment credits and charges.
Case "txttotalcharges"
sTabTo = "txtsecuritydeposit"
Case "txtsecuritydeposit"
sTabTo = "txtinterestearned"
Case "txtinterestearned"
sTabTo = "txtliquidateddamage"
Case "txtliquidateddamage"
sTabTo = "txttotalchargesdue"
Case "txttotalchargesdue"
sTabTo = "txtbalancedue"
Case "txtbalancedue"
sTabTo = "txtrefunddue"
'Tabs to comments.
Case "txtrefunddue"
sTabTo = "txtcomment1"
Case "txtcomment1"
sTabTo = "txtcomment2"
Case "txtcomment2"
sTabTo = "txtcomment3"
Case Else
End Select
Selection.GoTo What:=wdGoToBookmark, Name:=sTabTo
End Sub