1

I'm using Shapes.AddTextbox Method() in my code, in particular in a given condition I add a new text box and then I delete it. The problem is, when the textbox is created I receive a messagebox from Excel that shows the number of the text box created, then I have to click on the "OK" button of the message box in order to close it and continue running the code. I there a way to avoid this message box appears?

thanks ! regards

1
  • Can you provide your code? Commented Aug 3, 2017 at 10:01

1 Answer 1

3

It will be easier to ans if you can provide your code.

By the way please see the below example so that you can get the idea how add a text box in your excel file.

 Sub DrawTextbox()
    Dim ws As Worksheet, s As Shape
    Set ws = ActiveSheet
    ' Create label (height/width will be set by AutoSize).
    Set s = ws.Shapes.AddTextbox(msoTextOrientationHorizontal, 10, 10, 100, 100)
    s.TextFrame.Characters.Text = "This is some label text"
    ' Resize text box to fit text.
    s.TextFrame.AutoSize = True
end sub
Sign up to request clarification or add additional context in comments.

1 Comment

This answer gave me just enough information to figure out how to work with TextBoxes. If you need to use the same TextBox later, you can name it, e.g. s.Name = "mybox". Later, when you need to use it again, do something like Set s = ws.Shapes("mybox").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.