question

PabloLGamarra-1271 avatar image
0 Votes"
PabloLGamarra-1271 asked GabrielDzsurdzsa-8881 answered

Reply dialog box with Excel VB

Good estimates, my problem is the following I am trying to automate a cell phone recharge process with Excel the problem that arose is that when the code clicks on the accept button a dialog window is displayed asking if you want to do that recharge to that specified number and with the accept or cancel buttons, this in the vb code I get a warning that says "the object or class does not support the set of events", I think it is because I have to declare the dialog window As an object but I don't know how, if someone can give me help I would be very grateful.

Greetings!

ps: I have attached an image of the dialog window so you can understand it better124312-recarga.png


not-supported
recarga.png (5.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

GabrielDzsurdzsa-8881 avatar image
0 Votes"
GabrielDzsurdzsa-8881 answered

The MsgBox object comes with Excel, you don't need to construct it. What you would need to do is capture the result of the choice the user makes, and execute your code accordingly.

For a function on how to store MsgBoxResult as an object. Read up on:

vba-choice-messagebox


 Public Function Prompt()
    
     Dim Choice As VbMsgBoxResult
        
   'Store the message result object
   Choice = MsgBox("Ask the user a question?", vbQuestion + vbYesNo)
    
     Select Case Choice
            
         Case vbYes
            
             'Return something in the function
             Prompt = 1
            
         Case vbNo
            
             'Return something in the function
             Prompt = 0
            
     End Select
    
 End Function
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PabloLGamarra-1271 avatar image
0 Votes"
PabloLGamarra-1271 answered

Reformulate the question: Good estimates, my problem is the following I am trying to automate a cell phone recharging process with Excel the problem that arises is that when the code clicks on the accept button a dialog window is displayed asking if it is wants to do that reload to that specified number and with the accept or cancel buttons, this in the vb code I get a warning that says "the object or class does not support the set of events", I think it is because I have to declare The dialog window as an object but I don't know how, if someone can give me a help I would be very grateful.

Greetings!

ps: I have attached an image of the dialog window so you can understand it better!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DSPatrick avatar image
0 Votes"
DSPatrick answered

Q&A forums are currently English only. I'd try asking for help over here in dedicated forums.
https://social.msdn.microsoft.com/Forums/es-es/home
https://social.technet.microsoft.com/Forums/es-es/home
https://answers.microsoft.com/es-es

--please don't forget to upvote and Accept as answer if the reply is helpful--


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.