VBA Shapes.AddTextbox方法 [英] VBA Shapes.AddTextbox Method

查看:920
本文介绍了VBA Shapes.AddTextbox方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代码中使用Shapes.AddTextbox Method(),特别是在给定条件下,我添加了一个新文本框,然后将其删除.问题是,创建文本框时,我从Excel收到一个消息框,其中显示了创建的文本框的编号,然后我必须单击消息框的确定"按钮才能关闭它并继续运行代码. 我有办法避免出现此消息框吗?

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?

谢谢! 问候

推荐答案

如果您可以提供代码,则将更容易解决问题.

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

请顺便看下面的示例,以便您了解如何在excel文件中添加文本框.

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

这篇关于VBA Shapes.AddTextbox方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆