Try this:
If MsgBox("Test", vbYesNo, "Title") = vbYes Then
'Enter code for selection yes
Else
'Enter code for selection no or use Exit Sub
End If
Hi
Dim Answer as vbmessageboxresult
answer = msgbox("What do know what you want to do?,vbyesno,"Title"
select case answer
case vbyes
your code here
case vbno
your code here
this code will work with more buttons as well like abort/retry/cancel, just add another case.
HTH
Jacob
Jacob. How much dif does a dim make to the speed of the application. I have made a huge program. but have no dims because i have never understood how important their functionality was. the program is full of macros.
Hi
Check out the help on data types. If the type isnt specified then it is a variant which used more memory. since it has to be able to accept every type of value. If you specify what it is like date, integer etc. Then it uses less memory. In practivle terms I dont think it matters, but it is a good practice anyways. When debugging your program or going back to modify them months later you may not remember what the variable do, so you have to take more time going through code. Also you should use option explicit at the top of your modules to force yourself to declare variables this will prevent errors on mispelled variable. For example: If you have Myvalue = this+that and later on in the code you put Myvalu it will be 0 since myvalu doesnt equal anything, but with option explicit it would give you the error undefined variable and show you the variable so you can fix the problem immediately.
HTH
Jacob