+ Reply to Thread
Results 1 to 6 of 6

why does this fail?

  1. #1
    Gixxer_J_97
    Guest

    why does this fail?

    public sub test()
    dim c as integer,s1 as string, s2 as string
    s1="My Message"
    s2 = "My Title"
    c=msgbox(s1,vbyesno,s2)
    if c=vbyes then
    msgbox "hi"
    else
    msgbox "bye"
    end if
    end sub

    this is always displaying "bye"

    why? c (just after assignment) contains 6
    at the test, c is empty

    what am i missing?

    it works using

    if msgbox(s1,vbyesno,s2)=vbyes then ....

    jooc

    thanks

    J


  2. #2
    Jim Thomlinson
    Guest

    RE: why does this fail?

    Don't know why it does not owrk for you. It works for me... The only thing I
    see is that msgbox returns a long not an integer. Not thgat it has ever
    caused me a problem using int but as a technicallity...

    Jim Thomlinson


    "Gixxer_J_97" wrote:

    > public sub test()
    > dim c as integer,s1 as string, s2 as string
    > s1="My Message"
    > s2 = "My Title"
    > c=msgbox(s1,vbyesno,s2)
    > if c=vbyes then
    > msgbox "hi"
    > else
    > msgbox "bye"
    > end if
    > end sub
    >
    > this is always displaying "bye"
    >
    > why? c (just after assignment) contains 6
    > at the test, c is empty
    >
    > what am i missing?
    >
    > it works using
    >
    > if msgbox(s1,vbyesno,s2)=vbyes then ....
    >
    > jooc
    >
    > thanks
    >
    > J
    >


  3. #3
    Bob Phillips
    Guest

    Re: why does this fail?

    It works fine for me too. As Jim says, technically the button constants are
    Longs, but I also don't get a problem with Integer, and I tried with 97,
    2000 and XP. If you have 2003, try it with Long.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Jim Thomlinson" <[email protected]> wrote in message
    news:[email protected]...
    > Don't know why it does not owrk for you. It works for me... The only thing

    I
    > see is that msgbox returns a long not an integer. Not thgat it has ever
    > caused me a problem using int but as a technicallity...
    >
    > Jim Thomlinson
    >
    >
    > "Gixxer_J_97" wrote:
    >
    > > public sub test()
    > > dim c as integer,s1 as string, s2 as string
    > > s1="My Message"
    > > s2 = "My Title"
    > > c=msgbox(s1,vbyesno,s2)
    > > if c=vbyes then
    > > msgbox "hi"
    > > else
    > > msgbox "bye"
    > > end if
    > > end sub
    > >
    > > this is always displaying "bye"
    > >
    > > why? c (just after assignment) contains 6
    > > at the test, c is empty
    > >
    > > what am i missing?
    > >
    > > it works using
    > >
    > > if msgbox(s1,vbyesno,s2)=vbyes then ....
    > >
    > > jooc
    > >
    > > thanks
    > >
    > > J
    > >




  4. #4
    Jim Thomlinson
    Guest

    Re: why does this fail?

    I tried in in 2003 and 2000. It wall workd fine for me... I would love to
    know what might be causing that.

    Jim Thomlinson
    P.S. Bob is the one who let me in on the whole long thing. I used to always
    use int also. Until Bob pointed out the only two (very obscure) long return
    values that a message box can send. That knowledge will stick with me until
    long after I am dead... Thanks Bob...

    "Bob Phillips" wrote:

    > It works fine for me too. As Jim says, technically the button constants are
    > Longs, but I also don't get a problem with Integer, and I tried with 97,
    > 2000 and XP. If you have 2003, try it with Long.
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Jim Thomlinson" <[email protected]> wrote in message
    > news:[email protected]...
    > > Don't know why it does not owrk for you. It works for me... The only thing

    > I
    > > see is that msgbox returns a long not an integer. Not thgat it has ever
    > > caused me a problem using int but as a technicallity...
    > >
    > > Jim Thomlinson
    > >
    > >
    > > "Gixxer_J_97" wrote:
    > >
    > > > public sub test()
    > > > dim c as integer,s1 as string, s2 as string
    > > > s1="My Message"
    > > > s2 = "My Title"
    > > > c=msgbox(s1,vbyesno,s2)
    > > > if c=vbyes then
    > > > msgbox "hi"
    > > > else
    > > > msgbox "bye"
    > > > end if
    > > > end sub
    > > >
    > > > this is always displaying "bye"
    > > >
    > > > why? c (just after assignment) contains 6
    > > > at the test, c is empty
    > > >
    > > > what am i missing?
    > > >
    > > > it works using
    > > >
    > > > if msgbox(s1,vbyesno,s2)=vbyes then ....
    > > >
    > > > jooc
    > > >
    > > > thanks
    > > >
    > > > J
    > > >

    >
    >
    >


  5. #5
    Gixxer_J_97
    Guest

    Re: why does this fail?

    hmmm - i'm using 2003 and on 2 different machines it did the same thing
    both xp pro sp2 - dunno if that makes a difference

    also in my project and in a new workbook it failed too - i'm stumped. it
    has worked in the past, which is why i'm confused as to why it doesn't now.

    /shrug

    and i used int because msgbox returns an integer - according to the help.
    but thanks for pointing that out.

    J

    "Jim Thomlinson" wrote:

    > I tried in in 2003 and 2000. It wall workd fine for me... I would love to
    > know what might be causing that.
    >
    > Jim Thomlinson
    > P.S. Bob is the one who let me in on the whole long thing. I used to always
    > use int also. Until Bob pointed out the only two (very obscure) long return
    > values that a message box can send. That knowledge will stick with me until
    > long after I am dead... Thanks Bob...
    >
    > "Bob Phillips" wrote:
    >
    > > It works fine for me too. As Jim says, technically the button constants are
    > > Longs, but I also don't get a problem with Integer, and I tried with 97,
    > > 2000 and XP. If you have 2003, try it with Long.
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Jim Thomlinson" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Don't know why it does not owrk for you. It works for me... The only thing

    > > I
    > > > see is that msgbox returns a long not an integer. Not thgat it has ever
    > > > caused me a problem using int but as a technicallity...
    > > >
    > > > Jim Thomlinson
    > > >
    > > >
    > > > "Gixxer_J_97" wrote:
    > > >
    > > > > public sub test()
    > > > > dim c as integer,s1 as string, s2 as string
    > > > > s1="My Message"
    > > > > s2 = "My Title"
    > > > > c=msgbox(s1,vbyesno,s2)
    > > > > if c=vbyes then
    > > > > msgbox "hi"
    > > > > else
    > > > > msgbox "bye"
    > > > > end if
    > > > > end sub
    > > > >
    > > > > this is always displaying "bye"
    > > > >
    > > > > why? c (just after assignment) contains 6
    > > > > at the test, c is empty
    > > > >
    > > > > what am i missing?
    > > > >
    > > > > it works using
    > > > >
    > > > > if msgbox(s1,vbyesno,s2)=vbyes then ....
    > > > >
    > > > > jooc
    > > > >
    > > > > thanks
    > > > >
    > > > > J
    > > > >

    > >
    > >
    > >


  6. #6
    Tom Ogilvy
    Guest

    Re: why does this fail?

    Guess they need to update the documentation:

    ? typename(msgbox("ABCD"))
    Long


    --
    Regards,
    Tom Ogilvy

    "Gixxer_J_97" <[email protected]> wrote in message
    news:[email protected]...
    > hmmm - i'm using 2003 and on 2 different machines it did the same thing
    > both xp pro sp2 - dunno if that makes a difference
    >
    > also in my project and in a new workbook it failed too - i'm stumped. it
    > has worked in the past, which is why i'm confused as to why it doesn't

    now.
    >
    > /shrug
    >
    > and i used int because msgbox returns an integer - according to the help.
    > but thanks for pointing that out.
    >
    > J
    >
    > "Jim Thomlinson" wrote:
    >
    > > I tried in in 2003 and 2000. It wall workd fine for me... I would love

    to
    > > know what might be causing that.
    > >
    > > Jim Thomlinson
    > > P.S. Bob is the one who let me in on the whole long thing. I used to

    always
    > > use int also. Until Bob pointed out the only two (very obscure) long

    return
    > > values that a message box can send. That knowledge will stick with me

    until
    > > long after I am dead... Thanks Bob...
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > It works fine for me too. As Jim says, technically the button

    constants are
    > > > Longs, but I also don't get a problem with Integer, and I tried with

    97,
    > > > 2000 and XP. If you have 2003, try it with Long.
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "Jim Thomlinson" <[email protected]> wrote in

    message
    > > > news:[email protected]...
    > > > > Don't know why it does not owrk for you. It works for me... The only

    thing
    > > > I
    > > > > see is that msgbox returns a long not an integer. Not thgat it has

    ever
    > > > > caused me a problem using int but as a technicallity...
    > > > >
    > > > > Jim Thomlinson
    > > > >
    > > > >
    > > > > "Gixxer_J_97" wrote:
    > > > >
    > > > > > public sub test()
    > > > > > dim c as integer,s1 as string, s2 as string
    > > > > > s1="My Message"
    > > > > > s2 = "My Title"
    > > > > > c=msgbox(s1,vbyesno,s2)
    > > > > > if c=vbyes then
    > > > > > msgbox "hi"
    > > > > > else
    > > > > > msgbox "bye"
    > > > > > end if
    > > > > > end sub
    > > > > >
    > > > > > this is always displaying "bye"
    > > > > >
    > > > > > why? c (just after assignment) contains 6
    > > > > > at the test, c is empty
    > > > > >
    > > > > > what am i missing?
    > > > > >
    > > > > > it works using
    > > > > >
    > > > > > if msgbox(s1,vbyesno,s2)=vbyes then ....
    > > > > >
    > > > > > jooc
    > > > > >
    > > > > > thanks
    > > > > >
    > > > > > J
    > > > > >
    > > >
    > > >
    > > >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1