excel - 是否有 Excel VBA 函数来调整文本大小以适应形状?
问题描述
我在 excel 中画了一个圆圈,里面有一个数字,但是一旦这个数字达到两位数,第二个数字就看不到了。
我希望 textsize 适合形状。
我不能改变圆圈的大小,因为这是基于机会价值的。
我正在做一个业务漏斗,漏斗的相关输入是: - 票号 - 机会价值(潜在收入):用于调整圆圈大小
圆圈在漏斗中绘制,漏斗分为四个阶段,描绘为四种形状。
我努力了:
Public Function DrawCircle(x As Integer, y As Integer, tickets As Collection, ticketIndex As Integer)
Dim myCircle As Shape
Dim circleSize As Integer
circleSize = GetTicketSize(tickets, ticketIndex)
Dim name As String
name = "" & tickets.Item(ticketIndex).id
Set myCircle = ThisWorkbook.Sheets("Graphic funnel").Shapes.AddShape(msoShapeOval, x, y, circleSize, circleSize)
myCircle.Select
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.TextFrame.Characters.Text = name
Selection.ShapeRange.Left = Selection.ShapeRange.Left
Selection.ShapeRange.Top = Selection.ShapeRange.Top - circleSize / 2
With myCircle
.DeleteText
.wrapformat = msoWrapFormat
.WordWrap = True
.AutoSize = msoAutoSizeTextToFitShape
End With
但它返回:“对象不支持此属性或方法”
解决方案
推荐阅读
- forms - 将控制台参数解析到浏览器的批处理脚本
- jvm - 如何为 -XX:AbortVMOnException 定义多个错误
- c++ - 额外限定,无法从“int”转换为“Rational”
- javascript - 确保 Dexie.js 字段中的数据类型
- c# - 为什么多个班级成员分配会产生冗余装配?
- vaadin - Vaadin 14 重新路由
- sql - 用于更新列的 Sql 查询
- gmail - 后缀、转发和 SPF
- python - 有没有办法在 Seaborn/Python 的 Catplot 网格内的所有图上添加线图?
- python - 遍历数据框并使用 pd.DateOffset 设置日期