Hi
I am using a Mac and I want to create a text box that appears and then is deleted after 3 seconds. With this code, the text box is waiting 3 seconds to be inserted and the instantly deleted. It's doing the opposite of what I need. I'm baffled that the time value is being used by code that appears before it.
Thanks in advance!
I am using a Mac and I want to create a text box that appears and then is deleted after 3 seconds. With this code, the text box is waiting 3 seconds to be inserted and the instantly deleted. It's doing the opposite of what I need. I'm baffled that the time value is being used by code that appears before it.
Thanks in advance!
VBA Code:
Sub InsertAndDeleteTextBox()
Dim shp As Shape
Set shp = ActiveSheet.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, Left:=100, Top:=100, Width:=100, Height:=30)
shp.TextFrame.Characters.Text = "Hello"
' Wait for 3 seconds before deleting the text box
Application.Wait Now + TimeValue("00:00:03")
'Delete the text box
shp.Delete
End Sub
Last edited by a moderator: