View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
zz zz is offline
external usenet poster
 
Posts: 32
Default Custom msgbox help needed!!!

yah, i dont mind too much for the spam, gmail's filter works pretty fine.

well and , it is a major discovery to me in my very personal way, i do not
know too much about VBA or VB or XL, and everything i know is thanks to
everybody here, and i am sure that here are some enthusiasts that are
'discovering' this tool just like me, and i thougth it would be nice to
share this with them.

guess it shouldn't be a great discovery to you, since you are a great expert
on this subject...

but wath the hell, it is like glory to me when something i had never done
before works well.

regards.


--
---
zz [MX]
cuasi-musico,semi-poeta y loco


"Tom Ogilvy" wrote in message
...
I wouldn't be too concerned about "all the spam". I have been posting here
for 9 years using an unprotected email address and wouldn't consider the
amount of SPAM I get to be any big deal.

Using a public variable is pretty standard fare. Unfortunately, you made
it sound like you had a major discovery.

but thanks for posting your solution! - I am sure it will be useful for
many.

--
Regards,
Tom Ogilvy


"zz" wrote in message
...
well, thanks for all the spam i will get.[ no hard feelings]


i am completely sorry if that was the impression i caused, of course i do
not mean breaking the spirit of the group, no, sorry again.


Bad zz !! bad zz !!, no cookies for you tonight!!!



so for my redemption.


'// i know it has some 'scratches' and it could have been a little bit
more effective, but i'm under a little pressure to finish this '//before
xmas and as long as it works...




in a regular module called msgs i declared this function



Public returnanswer As Integer ' ///this is a global variable that can
be set from Frmmsg's events

Public Function Messagebox(Msg As String, Title As String, typeofmsg As
Integer) As String

On Error GoTo errhandler

Load Frmmsg '// this loads the userform that 'acts' as the msgbox but
doesn't show it yet

Frmmsg.lblmsg.Caption = Msg '// places the message

Frmmsg.Caption = Title ' // sets the title ,obviously


Select Case typeofmsg
Case Is = 1
Frmmsg.typeofmsj.Picture =
LoadPicture("R:\Trainbox\Tbxclient\resources\Image s\Msgwarn.jpg") '//
show the 'yellow message sphere

Case Is = 2
Frmmsg.typeofmsj.Picture =
LoadPicture("R:\Trainbox\Tbxclient\resources\Image s\Msgerr.jpg") '// show
the
' red sphere pic

Case Is = 3
Frmmsg.typeofmsj.Picture =
LoadPicture("R:\Trainbox\Tbxclient\resources\Image s\Msgsuccess.jpg") '//
show
'the green sphere pic

End Select

Frmmsg.Show

'// this part is for the Messagebox to return a value that
can be handled like the VByes response in a regular msgbox

Select Case msgs.returnanswer

Case Is = 1
Messagebox= "TByes"
Case Is = 2
Messagebox = "TBNot"
Case Is = 3
Messagebox = "TBcancel"
End Select

errhandler:
Err.Clear
End Function



Now


in the Frmmsg i have three buttons one for yes, another for no and a
third for cancel




private sub Btntbyes_onclick

msgs.returnanswer=1 '// this is for the Messagebox function to return
"TByes"

unload frmmsg '// cause we don't need the msg anymore

end sub


private sub Btntbnot_onclick

msgs.returnanswer=2 '// this is for the Messagebox function to return
"TBno"

unload frmmsg '// cause we don't need the msg anymore

end sub

private sub Btntbcancel_onclick

msgs.returnanswer=3 '// this is for the Messagebox function to return
"TBcancel"

unload frmmsg '// cause we don't need the msg anymore

end sub



so now i can write


X= Messagebox("Wow " & application.username & " you're handsome!! " &
VbCrlf & " am i right?" ,"Self esteem enhancer",3)
if x="TByes"
then
Messagebox "Liar!!!!","Go back to work",2
else
Messagebox "c'mon!, you know youre not but i still like you the best
"," Please return to your activities",3
endif

actually this is not the purpose for what i use it, but i tought this
would be funnier.


Best regards, hope it may be usefull.


--
:=)
---
zz [MX]
cuasi-musico,semi-poeta y loco



"Tom Ogilvy" wrote in message
...
You mean if I was reading this thread and I wanted to find out the
solution, I would need to send an email to





Doesn't seem like that is in the spirit of the newsgroup?

--
Regards,
Tom Ogilvy



"zz" wrote in message
...
thanks for the reply but i have already figured it out !!!...

if anybody wants to know how send me an email to
Jarious[dot]com[at]gmail[dot]com


--
---
zz [MX]
cuasi-musico,semi-poeta y loco

"Simon Lloyd" wrote
in message ...

Hi not sure entirely what you want to do but this is how to make use
of
Yes, No and Cancel from a message box:


Code:
--------------------
Sub Mbox()
Select Case MsgBox("What Now", vbYesNoCancel, "Decision Maker")
Case vbYes
MsgBox "Good"
Case vbNo
MsgBox "Bad"
Case vbCancel
MsgBox "Ugly"
End Select

End Sub
--------------------
Hope this helps,
Regards,
Simon


--
Simon Lloyd