1

Could you help me please?

I want to make message box for validating surveys.

the message box contain the message because error of stuffing.

I want my message box keep showing, so i can click the sheets which contain error of stuffing without closing the message box.

So, the message box will guide me to fix the error in that sheets

This is my previous code:

Private Sub CommandButton1_Click()

Dim error As String error = “”

If (vehicle = True) And (gasoline_month = 0) Then 
error = error & “- the expenditure of gasoline should not be empty” & Chr(10)

End If

If error = “” Then msgbox “clean”, vbInformation Else MsgBox error, vbCritical 

End Sub

Thank you, I hope anyone can help me,, (sorry for my bad english)

Plagon
  • 2,689
  • 1
  • 11
  • 23
arifulromadhon
  • 71
  • 1
  • 1
  • 10
  • it is not possible with msgbox vba. – Shrikant Aug 05 '17 at 11:01
  • Check [this](https://stackoverflow.com/a/5460823/7938503) out. You are not expecting an user input, so this could be a good option for you. – Plagon Aug 05 '17 at 11:06
  • I change the last code with this If error = "" Then Application.StatusBar = "clean" Else error Then i run the code, the message cannot appear. how application status bar work? I am so sorry because i just learn macro excel. i still dont understand a lot. :). could you give example from my code above? Thank you very much – arifulromadhon Aug 05 '17 at 11:46
  • i just try and works! Thank you. but, there is a problem. I have a lot of error message but the status bar is so small. Can I enlarge the status bar? – arifulromadhon Aug 05 '17 at 12:10
  • I dont think so. Then you have to use an userform. – Plagon Aug 05 '17 at 14:31
  • I would make a custom userform and turn modal false, keep window on top. That way it wouldn't interfere with you clicking to the worksheet, but it would stay visible while you search for errors. – Tyeler Aug 06 '17 at 04:44
  • thank you very much UGP and tyeler. so glad, to be replied by the experts. Do you have the example userform file that maybe the same in my case? because i never make userform before. It might be help me to learn about userform. thank you very much :) – arifulromadhon Aug 07 '17 at 05:56
  • Mr. @UGP, could I ask you for more? I just face a new problem. A lot of status bars make runtime error '1004' methods 'status bar' of object'_application' failed. How to fix It? – arifulromadhon Aug 10 '17 at 15:28
  • If you have so many tasks you should use a userform for it and not the statusbar, easiest solution. – Plagon Aug 11 '17 at 05:43

1 Answers1

0

Hi it is not possible with msgbox in VBA , you have to use userform for achieve this.

Add a userform in and place buttons as you need and try.

if you stuck somewhere do let us know.

Shrikant
  • 523
  • 4
  • 15