ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 4197|回复: 4

FAQ 【Shape 物件】{建立中}

[复制链接]

TA的精华主题

TA的得分主题

发表于 2004-12-1 01:19 | 显示全部楼层 |阅读模式

FAQ 【Shape 物件】{建立中}

只删除指定区域的贴图

请参考【只删除指定区域的贴图】

如何快速删除工作表中的图片

请参考【如何快速删除工作表中的图片 Chijanzen】

运用Excel VBA宏来操控Office小帮手

请参考 台湾洪士吉先生的 【运用Excel VBA宏来操控Office小帮手】 ------

[此贴子已经被作者于2005-3-9 21:35:03编辑过]

TA的精华主题

TA的得分主题

 楼主| 发表于 2004-12-1 11:40 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
在新板本的 Excel 有拍照这个工能,以下编码可将打印范围拍照储存成 Gif 档。它的方法亦很特别


Sub ScreenShot()
Dim wks As Worksheet
Dim cht As Chart
Dim intCounter As Integer
Application.ScreenUpdating = False
   Set wks = ActiveSheet
   wks.Range(wks.PageSetup.PrintArea).CopyPicture Appearance:=xlScreen, _
   format:=xlPicture
   Set cht = Charts.Add
   With cht
       On Error Resume Next
       .Paste
       On Error GoTo 0
   End With
   cht.Export "c:\temp\" & wks.Name & ".gif"
   Application.DisplayAlerts = False
   cht.Delete
   Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Excel 转换图像到 WorkSheet

请参考【Excel 轉換圖像】

一个可以将 Excel 选取范围转成 JPG 格式的 Add-in ,[Emily 分享] 3/F

[此贴子已经被作者于2006-9-23 9:46:33编辑过]

TA的精华主题

TA的得分主题

 楼主| 发表于 2005-1-6 11:01 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

如何测试有没有背景图

Set CmdBar = Application.CommandBars(1)
Set CmdBarMenu = CmdBar.Controls(5)
Set CheckBackGnd = CmdBarMenu.Controls(4).Controls(4)
If CheckBackGnd.Caption = 删除背景(&D)" Then
     MsgBox "已有背景图"
Else
     MsgBox "没有背景图"
End If

[此贴子已经被作者于2006-9-23 9:46:01编辑过]

TA的精华主题

TA的得分主题

 楼主| 发表于 2005-3-15 15:49 | 显示全部楼层

如何在设定批注的文本框的宽度的情况下使高度自动调整以适应其中所包含的文字

Sub Comments_AutoSize()
  Dim MyComments As Comment
  Dim lArea As Long
  For Each MyComments In ActiveSheet.Comments
    With MyComments
      .Shape.TextFrame.AutoSize = True
      If .Shape.Width <> 200 Then
        lArea = .Shape.Width * .Shape.Height
        .Shape.Width = 200
        .Shape.Height = (lArea / 200)
      End If
    End With
  Next
End Sub


[此贴子已经被作者于2006-9-23 9:45:29编辑过]

TA的精华主题

TA的得分主题

 楼主| 发表于 2005-7-10 12:36 | 显示全部楼层

[分享]Scaled-in-cell-charting

Scaled-in-cell-charting

Usage: =linechart(A3:E3,203,$A$3:$E$8) ' A3:E8 numeric data, 203 is RGB value
 

Function LineChart(Points As Range, Color As Long, Optional VerticalScale As Range) As String
   
    Dim rCaller As Range
    Dim avNames() As Variant
    Dim i As Long, j As Long, k As Long
    Dim dMin As Double, dMax As Double, dScaleMin As Double, dScaleMax As Double
    Dim shp As Shape
    Dim rScale As Range
    Dim dEffWidth As Double, dEffHeight As Double, dEffBottom As Double, dEffLeft As Double
   
    Const lMARGIN As Long = 2
    Set rCaller = Application.Caller
    ShapeDelete rCaller
    'If VerticalScale Is Nothing Then
    '    Set rScale = Points
    'Else
    '    Set rScale = VerticalScale
    'End If
    If VerticalScale Is Nothing Then
        Set rScale = Points
    Else
        If Not Application.Intersect(Points, VerticalScale) Is Nothing Then
            If Application.Intersect(Points, VerticalScale).Address = _
                Points.Address Then
                Set rScale = VerticalScale
            Else
                Set rScale = Application.Union(Points, VerticalScale)
            End If
        Else
            Set rScale = Application.Union(Points, VerticalScale)
        End If
    End If

    With Application.WorksheetFunction
        dMin = .Min(Points)
        dMax = .Max(Points)
        dScaleMin = .Min(rScale)
        dScaleMax = .Max(rScale)
    End With
   
    dEffWidth = rCaller.Width - (lMARGIN * 2)
    dEffHeight = rCaller.Height - (lMARGIN * 2)
    dEffBottom = rCaller.Top + lMARGIN + dEffHeight
    dEffLeft = rCaller.Left + lMARGIN
   
    With rCaller.Worksheet.Shapes
        For i = 0 To Points.Count - 2
           Set shp = .AddLine( _
                dEffLeft + (i * (dEffWidth) / (Points.Count - 1)), _
                dEffBottom - (dEffHeight * (Points(, i + 1) - dScaleMin + 1) / (dScaleMax - dScaleMin + 1)), _
                dEffLeft + ((i + 1) * (dEffWidth) / (Points.Count - 1)), _
                dEffBottom - (dEffHeight * (Points(, i + 2) - dScaleMin + 1) / (dScaleMax - dScaleMin + 1)))

            On Error Resume Next
                j = 0
                j = UBound(avNames) + 1
            On Error GoTo 0
            ReDim Preserve avNames(j)
            avNames(j) = shp.Name
        Next
        With rCaller.Worksheet.Shapes.Range(avNames)
            .Group
            .Line.ForeColor.RGB = Abs(Color)
        End With
    End With
    LineChart = ""
   
End Function


Sub ShapeDelete(rngSelect As Range)
    Dim rng As Range, shp As Shape, blnDelete As Boolean

    For Each shp In rngSelect.Worksheet.Shapes
        blnDelete = False
        Set rng = Intersect(Range(shp.TopLeftCell, shp.BottomRightCell), rngSelect)
        If Not rng Is Nothing Then
            If rng.Address = Range(shp.TopLeftCell, shp.BottomRightCell).Address Then blnDelete = True
        End If
        If blnDelete Then shp.Delete
    Next
End Sub

下载

Orginal Source:  http://www.dailydoseofexcel.com/archives/2006/09/13/scaled-in-cell-charting/

[此贴子已经被作者于2006-9-23 9:42:50编辑过]
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

关闭

最新热点上一条 /1 下一条

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-4-26 05:19 , Processed in 0.042855 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表