Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Function procedure too long

Hi

I'm having trouble making a function work. This function is too long, so I
have split it up. Below is an example. The below code call this function.
Unfortunately this function keeps looping and I can't get out of it. I'm at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test = checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Function procedure too long

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
Hi

I'm having trouble making a function work. This function is too long, so
I
have split it up. Below is an example. The below code call this function.
Unfortunately this function keeps looping and I can't get out of it. I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test = checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Function procedure too long

Hi Bob

Removing the call check_labels1 doesn't work properly either. Any other
suggestion?



"Bob Phillips" wrote:

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
Hi

I'm having trouble making a function work. This function is too long, so
I
have split it up. Below is an example. The below code call this function.
Unfortunately this function keeps looping and I can't get out of it. I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test = checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Function procedure too long

It wasn't just that, I changed the initial assignment of test as well.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
Hi Bob

Removing the call check_labels1 doesn't work properly either. Any other
suggestion?



"Bob Phillips" wrote:

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi

I'm having trouble making a function work. This function is too long,
so
I
have split it up. Below is an example. The below code call this
function.
Unfortunately this function keeps looping and I can't get out of it.
I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test =
checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Function procedure too long

No this still doesn't work. It doesn't recognize check_labels = true under
the second function (checkalllabels.Check_labels1)


"Bob Phillips" wrote:

It wasn't just that, I changed the initial assignment of test as well.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
Hi Bob

Removing the call check_labels1 doesn't work properly either. Any other
suggestion?



"Bob Phillips" wrote:

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi

I'm having trouble making a function work. This function is too long,
so
I
have split it up. Below is an example. The below code call this
function.
Unfortunately this function keeps looping and I can't get out of it.
I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test =
checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Function procedure too long

I didn't notice that bit, does this clear it



Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
No this still doesn't work. It doesn't recognize check_labels = true
under
the second function (checkalllabels.Check_labels1)


"Bob Phillips" wrote:

It wasn't just that, I changed the initial assignment of test as well.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi Bob

Removing the call check_labels1 doesn't work properly either. Any
other
suggestion?



"Bob Phillips" wrote:

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi

I'm having trouble making a function work. This function is too
long,
so
I
have split it up. Below is an example. The below code call this
function.
Unfortunately this function keeps looping and I can't get out of it.
I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test =
checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Function procedure too long

In addition, you should specify both the return type and default value:

Function Check_labels1() As Boolean 'Returns True or False
Check_labels1 = False 'Set default return value to False
'Rest of code

End Function


HTH,
Bernie
MS Excel MVP


"Bob Phillips" wrote in message ...
I didn't notice that bit, does this clear it



Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
No this still doesn't work. It doesn't recognize check_labels = true under
the second function (checkalllabels.Check_labels1)


"Bob Phillips" wrote:

It wasn't just that, I changed the initial assignment of test as well.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
Hi Bob

Removing the call check_labels1 doesn't work properly either. Any other
suggestion?



"Bob Phillips" wrote:

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi

I'm having trouble making a function work. This function is too long,
so
I
have split it up. Below is an example. The below code call this
function.
Unfortunately this function keeps looping and I can't get out of it.
I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test =
checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Function procedure too long

I've changed the second procedure with check_labels1 = true and the below
addition but it still doesn't stop. For example a message box will appear
stating the type of call wasn't selected (this was in the first procedure)
but will not stop and then it will bring another message stating tax agent
firm name required (from the second procedure). Any other suggestions?

"Bernie Deitrick" wrote:

In addition, you should specify both the return type and default value:

Function Check_labels1() As Boolean 'Returns True or False
Check_labels1 = False 'Set default return value to False
'Rest of code

End Function


HTH,
Bernie
MS Excel MVP


"Bob Phillips" wrote in message ...
I didn't notice that bit, does this clear it



Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
No this still doesn't work. It doesn't recognize check_labels = true under
the second function (checkalllabels.Check_labels1)


"Bob Phillips" wrote:

It wasn't just that, I changed the initial assignment of test as well.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
Hi Bob

Removing the call check_labels1 doesn't work properly either. Any other
suggestion?



"Bob Phillips" wrote:

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi

I'm having trouble making a function work. This function is too long,
so
I
have split it up. Below is an example. The below code call this
function.
Unfortunately this function keeps looping and I can't get out of it.
I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test =
checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function











  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Function procedure too long

Not unless you can post the workbook somewhere, we are working blind.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
I've changed the second procedure with check_labels1 = true and the below
addition but it still doesn't stop. For example a message box will appear
stating the type of call wasn't selected (this was in the first procedure)
but will not stop and then it will bring another message stating tax agent
firm name required (from the second procedure). Any other suggestions?

"Bernie Deitrick" wrote:

In addition, you should specify both the return type and default value:

Function Check_labels1() As Boolean 'Returns True or False
Check_labels1 = False 'Set default return value to False
'Rest of code

End Function


HTH,
Bernie
MS Excel MVP


"Bob Phillips" wrote in message
...
I didn't notice that bit, does this clear it



Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
No this still doesn't work. It doesn't recognize check_labels = true
under
the second function (checkalllabels.Check_labels1)


"Bob Phillips" wrote:

It wasn't just that, I changed the initial assignment of test as
well.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi Bob

Removing the call check_labels1 doesn't work properly either. Any
other
suggestion?



"Bob Phillips" wrote:

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi

I'm having trouble making a function work. This function is too
long,
so
I
have split it up. Below is an example. The below code call this
function.
Unfortunately this function keeps looping and I can't get out of
it.
I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test =
checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function













  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Function procedure too long

I could either email the worksheet to you or can post it if you advise me
where.

"Bob Phillips" wrote:

Not unless you can post the workbook somewhere, we are working blind.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
I've changed the second procedure with check_labels1 = true and the below
addition but it still doesn't stop. For example a message box will appear
stating the type of call wasn't selected (this was in the first procedure)
but will not stop and then it will bring another message stating tax agent
firm name required (from the second procedure). Any other suggestions?

"Bernie Deitrick" wrote:

In addition, you should specify both the return type and default value:

Function Check_labels1() As Boolean 'Returns True or False
Check_labels1 = False 'Set default return value to False
'Rest of code

End Function


HTH,
Bernie
MS Excel MVP


"Bob Phillips" wrote in message
...
I didn't notice that bit, does this clear it



Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
No this still doesn't work. It doesn't recognize check_labels = true
under
the second function (checkalllabels.Check_labels1)


"Bob Phillips" wrote:

It wasn't just that, I changed the initial assignment of test as
well.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi Bob

Removing the call check_labels1 doesn't work properly either. Any
other
suggestion?



"Bob Phillips" wrote:

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi

I'm having trouble making a function work. This function is too
long,
so
I
have split it up. Below is an example. The below code call this
function.
Unfortunately this function keeps looping and I can't get out of
it.
I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test =
checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function
















  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Function procedure too long

There are a number of free temporary storage sites out there, cjoint.com is
the one that I use.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in message
...
I could either email the worksheet to you or can post it if you advise me
where.

"Bob Phillips" wrote:

Not unless you can post the workbook somewhere, we are working blind.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
I've changed the second procedure with check_labels1 = true and the
below
addition but it still doesn't stop. For example a message box will
appear
stating the type of call wasn't selected (this was in the first
procedure)
but will not stop and then it will bring another message stating tax
agent
firm name required (from the second procedure). Any other suggestions?

"Bernie Deitrick" wrote:

In addition, you should specify both the return type and default
value:

Function Check_labels1() As Boolean 'Returns True or False
Check_labels1 = False 'Set default return value to False
'Rest of code

End Function


HTH,
Bernie
MS Excel MVP


"Bob Phillips" wrote in message
...
I didn't notice that bit, does this clear it



Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels1 = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
No this still doesn't work. It doesn't recognize check_labels =
true
under
the second function (checkalllabels.Check_labels1)


"Bob Phillips" wrote:

It wasn't just that, I changed the initial assignment of test as
well.

--
__________________________________
HTH

Bob

"bluewatermist" wrote in
message
...
Hi Bob

Removing the call check_labels1 doesn't work properly either.
Any
other
suggestion?



"Bob Phillips" wrote:

Guessing somewhat, but perhaps

test = checkalllabels.check_labels And _
checkalllabels.Check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
End If

End Function

Function Check_labels1()

If CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation,
""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And _
CWC_Note.contactlistedon.Value = "FBT tax agent"
Then
MsgBox "Tax agent firm name required", vbExclamation,
""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
End If

End Function


--
__________________________________
HTH

Bob

"bluewatermist" wrote
in
message
...
Hi

I'm having trouble making a function work. This function is
too
long,
so
I
have split it up. Below is an example. The below code call
this
function.
Unfortunately this function keeps looping and I can't get out
of
it.
I'm
at a
loss as to what to do. Hopefully you can help me.

Thank you.

test = Checkalllabels.check_labels and test =
checkalllabels.check_labels1
If test = True Then
Exit Sub
End If


Function check_labels()

If CWC_Note.typeofcontact.Value = Clear Then
MsgBox "Type of call not selected", vbExclamation, ""
check_labels = True
CWC_Note.typeofcontact.SetFocus

ElseIf CWC_Note.nameofcontact.Value = Clear Then
MsgBox "Callers name required", vbExclamation, ""
check_labels = True
CWC_Note.nameofcontact.SetFocus
end if

call Check_labels1

end function
Function Check_labels1 ()

If CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "CAC tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus

ElseIf CWC_Note.taxagentfirmname.Value = Clear And
CWC_Note.contactlistedon.Value = "FBT tax agent" Then
MsgBox "Tax agent firm name required", vbExclamation, ""
check_labels = True
CWC_Note.taxagentfirmname.SetFocus
endif

end function
















Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
Long Long Long Nested If Function sed Excel Discussion (Misc queries) 4 December 9th 09 06:44 PM
function to figure out which procedure Monique Excel Programming 2 September 15th 06 04:30 PM
procedure/function calling raja Excel Programming 1 October 3rd 05 12:32 PM
Compile Error: Procedure too long Excel-erate2004[_3_] Excel Programming 4 April 22nd 04 11:43 PM


All times are GMT +1. The time now is 06:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"