VBA Solidworks,MsgBox that closes automatically

Hi all

I found this command line in VBA initially used in Excel :  (here: https://excel-malin.com/codes-sources-vba/msgbox-qui-se-ferme-automatique/)

CreateObject("WScript.Shell"). Popup "Dialog Contents ... ", 5, "Title of the dialog box"    //5 being here the theoretical duration in seconds

in order to carry out macros with fleeting messages (adjustable timer).

In Excel it works pretty well (the tempo is not really respected), but not in solidworks??? The window appears but does not disappear...

Is there an alternative to make this message disappear after a few seconds so as not to block the macro?

Is there a function to enable in solidworks for this command to work?

FYI, my macros are simple and don't require (yet) the use of form with buttons.

Can you help me?

Kind regards

Thierry


boite_fugitive.swp

Hello;

A lead to dig  into (I haven't tested). 
In solidworks most messages are not in the form: msgbox(Message, Icon, Buttons)
but most often: SendMsgToUser2(Message, Icon, Buttons)

Kind regards.

Does not work under solidworks, even with the Microsoft Shell reference enabled.

The popup is displayed but remains until validation.

Maybe a limitation of the software prohibiting this kind of popup that was so unpleasant in an internet browser.

I think the only way to display a temporary message will be the solution you don't want with a form.

Hello sbadenis,

Thank you for your answer.

This is unfortunately what I fear, even if it's not too complicated to do I find it a shame that a "ready-made" command only works half on SW2021 and that it works completely on Excel 2013, even if the tempo is not precise...

In this case, I'm thinking of making a function asynchronously, unless there is a tempo function that exists.

Kind regards.

Hi all

I answer my own question to share.

It's just a counter that loops until it reaches the requested value.

It's not to the second and varies according to the power of the PC but it does the job.

Kind regards.


boite_fugitive.swp