PerlIsGood
Programmer
Well, not losing, but not being recognized. The following bit of code was written for a custom form in Outlook and has worked flawlessly since I put it together. Just today I decided to move all of the Set [VAR] statements to their own sub() to cut down on script size (there were near 30 for each function).
Now, around 80-85% of these same variables are being recognized, while the others simply are not, or I get an error saying that the variable is not a valid object...
Specific Example:
With this I get the error "Object required: txtCandEmail1". But then I have the Set txtCandEmail1 value in the SetVar() sub and it's set correctly (triple checked, twice). Not to mention that this same function is pulling and successfully using other variables from the sub().
I'm confused... There are two other functions exhibiting this same behavior with different variables. Anyone have any ideas why it would not be recognizing certain vars..?
Now, around 80-85% of these same variables are being recognized, while the others simply are not, or I get an error saying that the variable is not a valid object...
Specific Example:
Code:
Call SetVars() 'way earlier in the function...placed here for example...
If txtCandEmail1.Value > "" And txtCandEmail2.Value > "" Then
i.Recipients.Add txtCandEmail1
i.Recipients.Add txtCandEmail2
i.Recipients.Add txtGreeter
i.Display
ElseIf txtCandEmail1.Value > "" And txtCandEmail2.Value = "" Then
i.Recipients.Add txtCandEmail1
i.Recipients.Add txtGreeter
i.Display
ElseIf txtCandEmail2.Value > "" And txtCandEmail1.Value = "" Then
i.Recipients.Add txtCandEmail2
i.Recipients.Add txtGreeter
i.Display
Else
MsgBox ("msg text..."), , "No Email on File"
End If
I'm confused... There are two other functions exhibiting this same behavior with different variables. Anyone have any ideas why it would not be recognizing certain vars..?