Dr.Marten
Dr.Marten

Reputation: 21

VBA Shapes.AddTextbox Method

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

Upvotes: 1

Views: 9653

Answers (1)

Srikanta Gouda
Srikanta Gouda

Reputation: 521

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

Upvotes: 3

Related Questions