ANDstORy
ANDstORy
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: ANDstORy

  1. #1
    New Member
    Join Date
    Mar 2002
    Location
    India
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Dear Sir,

    If I write a statement like the following:

    var = False AND msgbox("ANDstORy")

    or a statement like the following:

    val = True OR msgbox("ANDstORy")

    in each case the outcome is a MessageBox conting the given message.

    My question is, is not it a but of VB/VBA handling with the AND and OR operators? Or am I going wrong? Please show me a light. Because in some cases I have no other way besides writing an If-Else ladder with so many indents. Even I am quite wondered to see that the Iif() function also does not work as expected. It works like the same as stated above. i.e. the following statement:

    var = Iif(True, 1, msgbox("ANDstORy"))

    also shows the MessageBox containing the the given messages. What is going on? If it is a but then why Microsoft is not going to rectify it? If I am going wrong then please explain why?

    Thanks.

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Essex, England
    Posts
    459
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    I don't claim to be an expert at this sort of thing and I could well be misunderstanding you, but I'm not sure that you're using the AND/OR statements correctly. I've only seen them used in conjuction with some kind of logical test ie IF (logical test) AND/OR (logical test) THEN...

    The Iif() problem I think is due to excel always evaluating both parts of the statement, even though it only needs one - I belive this is why your msgbox is appearing even though it is on the False part of the expression.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com