电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

第4章Shape(图形)、Chart(图表)对象代码[超实用VBA]

第4章Shape(图形)、Chart(图表)对象代码[超实用VBA]_第1页
1/6
第4章Shape(图形)、Chart(图表)对象代码[超实用VBA]_第2页
2/6
第4章Shape(图形)、Chart(图表)对象代码[超实用VBA]_第3页
3/6
3 2 第 4 章 Shape( 图 形 ) 、Chart( 图 表) 对象 范例47 在工作表中添加图形 Sub AddingGraphics() Dim MyShape As Shape On Error Resume Next Sheet1.Shapes("MyShape").Delete Set MyShape = Sheet1.Shapes.AddShape(msoShapeRectangle, 40, 120, 280, 30) With MyShape .Name = "MyShape" With .TextFrame.Characters .Text = "单击将选择 Sheet2!" With .Font .Size = 20 .ColorIndex = 5 End With End With With .Line .Weight = 1 .Style = msoLineSingle .Transparency = 0.5 .ForeColor.SchemeColor = 40 .BackColor.RGB = RGB(255, 255, 255) End With With .Fill .Transparency = 0.5 .ForeColor.SchemeColor = 41 .OneColorGradient 1, 4, 0.23 End With .Placement = 3 End With Sheet1.Hyperlinks.Add Anchor:=MyShape, Address:="", _ SubAddress:="Sheet2!A1", ScreenTip:="选择 Sheet2!" Set MyShape = Nothing End Sub 3 3 范例4 8 导出工作表中的图片 Sub ExportPictures() Dim MyShp As Shape Dim Filename As String For Each MyShp In Sheet1.Shapes If MyShp.Type = msoPicture Then Filename = ThisWorkbook.Path & "\" & MyShp.Name & ".gif" MyShp.Copy With Sheet1.ChartObjects.Add(0, 0, MyShp.Width, MyShp.Height).Chart .Paste .Export Filename .Parent.Delete End With End If Next Set MyShp = Nothing End Sub 范例4 9 在工作表中添加艺术字 Sub AddingWordArt() On Error Resume Next Sheet1.Shapes("MyShape").Delete Sheet1.Shapes.AddTextEffect _ (PresetTextEffect:=msoTextEffect16, _ Text:="Excel 2007", FontName:="宋体", _ FontSize:=50, FontBold:=True, _ FontItalic:=True, Left:=60, Top:=60).Name = "MyShape" End Sub 范例5 0 遍历工作表中的形状 Sub TraversalShapeOne() Dim i As Integer For i = 1 To 4 Sheet1.Shapes("文本框 " & i).TextFrame.Characters.Text = "" Next End Sub Sub TraversalShapeTwo() 3 4 Dim MyShape As Shape Dim MyCount As Integer MyCount = 1 For Each MyShape In Sheet1.Shapes If MyShape.Typ...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

第4章Shape(图形)、Chart(图表)对象代码[超实用VBA]

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部