PDA

View Full Version : [SOLVED] Timed Message Boxes not handling code in between



Sully1440
02-28-2018, 01:23 PM
Hi All,
I'm having some difficulties with timed message boxes, adding a shape to highlight a cell, and then continuing on with the next timed message box. It sorta works but it doesn't delete the shape until the code reaches the end of the message boxes. I want it to delete the shape called "Highlight" before it moves on to the next message box.

Sub Instructions_2()

CreateObject("WScript.Shell").Popup "Select the 'Clear Data' Button to clear data in the chart below", 4, "STEP 1"
CreateObject("WScript.Shell").Popup "Select the 'Get Data' Button to retrieve the data from the first tab", 4, "STEP 2"
CreateObject("WScript.Shell").Popup "Please make sure your Start Dates are updated", 4, "STEP 3"

'Application.ScreenUpdating = False
Sheets("Instruction Graphics").Select
ActiveSheet.Shapes.Range(Array("Highlight")).Select
Selection.Copy
Sheets("Sheet1").Select
Range("I8").Select
ActiveSheet.Paste
Range("A1").Select
'Application.ScreenUpdating = True

CreateObject("WScript.Shell").Popup "Dummy Percentages were applied. Please make sure your Percentages are updated", 4, "STEP 4"
ActiveSheet.Shapes("Highlight").Delete

CreateObject("WScript.Shell").Popup "Move this slider back and forth to review your results", 4, "STEP 5"

End Sub



Any suggestions would be very helpful...
Thanks,
Jim

georgiboy
02-28-2018, 01:50 PM
Lookup the use of

DoEvents

you would place it after the line that deletes the shape.

SamT
02-28-2018, 02:46 PM
Something similar to


With Sheets("Instruction Graphics").Shapes.Range(Array("Highlight"))
.Copy
.Delete
End with

Sheets("Sheet1").Range("I8").Select
ActiveSheet.Paste

Sully1440
02-28-2018, 06:15 PM
The DoEvents code works well. The other code also helps me delete shapes on the other page.

Thank you guys. Very much appreciated. I have one last question. Is there a way to position this message box somewhere on the screen other than in the middle?
Can I position the message box using this timed event somewhere else?

CreateObject("WScript.Shell").Popup "Select the 'Clear Data' Button to clear data in the chart below", 4, "STEP 1"

Thanks,
Jim

georgiboy
03-01-2018, 06:33 AM
Not that I know of, you can position an input box or a form.

you could create a form instead of a pop up and work with the form instead.

Sully1440
03-01-2018, 02:41 PM
Thanks for this info. I decided to go with a userform and it works for what I'm trying to do. I also know what to do with DoEvents too.

thx all for your help :)
jim