Calling procedures from a procedure

Hello there
I hope this question is not too stupid.
I am formatting a contractual document using some simple VBA. According to the options a user chooses in a window, Word should select one of sixteen ways to format the doc when OK is clicked. Having all sixteen 'formatting scripts' in one procedure with the accompanying IF.. THEN... ELSEIF statements was too long, so I have made each 'formatting script' a procedure.
Trouble is, when I try to call the procedures, nothing happens. What am I doing wrong
Here's what it looks like:

-------------------------

Private Sub cmdOK_Click()
frmContractSetup.Hide
Unload frmContractSetup

If chkUseRetainer = True And chkQuebec = True And chkLarge = True And chkUseLump = True Then

'[Load of VBA statements here, like:]
Selection.GoTo What:=wdGoToBookmark, Name:="Acknowledgement"
With Selection.Font
.Hidden = True
End With

'[Load more code..., then...]

ElseIf chkUseRetainer = True And chkPercentage = True And chkLarge = True And chkUseLump = False Then Call zB()

ElseIf chkUseRetainer = True And chkPercentage = True And chkLarge = False And chkUseLump = True Then Call zC()

[And some more ElseIf statements...]

End If

...

The procedures to be called, (zB, zC, etc.), are all stored in the project. I even tried storing them directly beneath the main procedure. They all essentially take the form:

Sub zB()

Selection.whatever...

End Sub

Hope this is sufficient information and I hope you can help.

Oh, I am using Word 2003.

Many thanks

Russ



Answer this question

Calling procedures from a procedure

  • GiMi

    Russ –

    Write a Sub Test() that sets a few of the parameters, execute it a step at a time, and trace through the code with the Locals window open.



  • Solent

    Many thanks Peter.

    I solved it by using application.run "ProjectName, ModuleName, ProcedureName. However, I used your Test and it is a useful new tip.

    Cheers

    Russ


  • Calling procedures from a procedure