How do I add Please wait.... in the code

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hello experts
My code takes more than 45 seconds to display the message box that the code has successfully completed. Is it possible to add some lines in the code like Please wait.... ? I am curious as well as excited to add that line in the code, as I have seen such messages before. This is to inform the user that the code is in motion and running so that he doesn't click any button till the message box is displayed. Once the code is run, the message Please wait.... should disappear and then display the message box that it is successfully completed.
 
Follow below points

1) See below screenshot & draw a shape in excel
2) Edit the shape & add text (what every you like - for example pls wait ect
2) then name the shape "waitmessage"
3) then put the below line at the very beggining of your code
VBA Code:
ActiveSheet.Shapes.Range(Array("wiatmessage")).Visible = True
4) the put the below line at the very end of your code
VBA Code:
ActiveSheet.Shapes.Range(Array("wiatmessage")).Visible = False
Should your line maybe not read

VBA Code:
ActiveSheet.Shapes.Range(Array("waitmessage")).Visible = True

instead of

VBA Code:
ActiveSheet.Shapes.Range(Array("wiatmessage")).Visible = True

Just noticed the spelling error 🙂
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
How do I name the message?
View attachment 73307

select the shape... then in the circled box just type "waitmessage" and press enter... name of shape should be changed then to it...

from this

Screenshot 2022-09-06 152919.png

to this

Screenshot 2022-09-06 154650.png
 
Upvote 0
Upvote 0
If I place it below the variables where they are defined and above the end sub, the code runs but doesn't display Please wait.....
If I place it above in the very beginning below option explicit, it shows an error.
 
Upvote 0
Rich (BB code):
    Dim ws                  As Worksheet
    Dim waitmesaage         As Long

'Code by hrayani

ActiveSheet.Shapes.Range(Array("waitmessage")).Visible = True
waitmesaage = "Please Wait....."



    Set dic = CreateObject("scripting.dictionary")                                              ' Establish dictionary
Placed in the beginning

Rich (BB code):
 ActiveSheet.Shapes.Range(Array("waitmessage")).Visible = False

    MsgBox "Data extracted successfully. Check Mismatched sheet for more Matches."                                         ' Display message to user

End Sub

Placed in the end
 
Upvote 0
Rich (BB code):
    Dim ws                  As Worksheet
    Dim waitmesaage         As Long

'Code by hrayani

ActiveSheet.Shapes.Range(Array("waitmessage")).Visible = True
waitmesaage = "Please Wait....."



    Set dic = CreateObject("scripting.dictionary")                                              ' Establish dictionary
Placed in the beginning

Rich (BB code):
 ActiveSheet.Shapes.Range(Array("waitmessage")).Visible = False

    MsgBox "Data extracted successfully. Check Mismatched sheet for more Matches."                                         ' Display message to user

End Sub

Placed in the end

Remove this line...and see what happens...

VBA Code:
waitmesaage = "Please Wait....."
 
Upvote 0
The above query is solved now. I placed these 2 lines of code in more than 10 different places in different modules and in the end another line of code to make the message disappear.
I created a userform to display the message and added this to the code
Rich (BB code):
UserForm1.Show 0
DoEvents
and in the end one more line of code
Rich (BB code):
Unload UserForm1

Untitled.png

Only thing is I was not able to do was increase the font size of the message.
 
Upvote 0
I assume this is a Label your using for you message on the UserForm

Click on the label. In the properties window select font and then select the font size you want to make the message font larger
 
Upvote 0
Solution

Forum statistics

Threads
1,216,077
Messages
6,128,676
Members
449,463
Latest member
Jojomen56

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top