[VBA]转别人的代码,EXCEL数据表导出到PPT生成图表(PPT端)
2011-12-15 23:55阅读:
自己的目标:需要在EXCEL中实现运行,采用参数表管理办法,具体参数表设想如下:
SHEET名称
数据表所在区域
PPT所在路径
PPT文件名称
数据表对应PPT页码
图表格式(此条待定,看具体情况)
-----------------------------------------------------------------------------------------
代码如下:
Dim Myarr()
Sub MylineExcel()
Dim Mypath As String, Myfile As String
Dim Myshe As Object, Myole As Object, Mycha As Object
Dim bta As Integer, btc As Integer, btk As Integer
Dim btb(), hdsz()
Mypath = ActivePresentation.Path '获得工作路径
Myfile = Dir(Mypath & '\数据源.xls')
'返回一个Excel文件名
If Myfile = '' Then Exit Sub
Set Myshe = GetObject(Mypath & '\数据源.xls').worksheets('sheet1')
Myarr = Myshe.UsedRange.Value
'数组赋值
Set Myshe = Nothing '清空对象
a = 0
bta = 1
btc = UBound(Myarr, 1)
btk = UBound(Myarr, 2)
ReDim Preserve btb(0)
btb(0) = 1
For i = 1 To btc
'该循环为取得'小计'的行
SHEET名称
数据表所在区域
PPT所在路径
PPT文件名称
数据表对应PPT页码
图表格式(此条待定,看具体情况)
-----------------------------------------------------------------------------------------
代码如下:
Dim Myarr()
Sub MylineExcel()
Dim Mypath As String, Myfile As String
Dim Myshe As Object, Myole As Object, Mycha As Object
Dim bta As Integer, btc As Integer, btk As Integer
Dim btb(), hdsz()
Mypath = ActivePresentation.Path
Myfile = Dir(Mypath & '\数据源.xls')
If Myfile = '' Then Exit Sub
Set Myshe = GetObject(Mypath & '\数据源.xls').worksheets('sheet1')
Myarr = Myshe.UsedRange.Value
Set Myshe = Nothing
a = 0
bta = 1
btc = UBound(Myarr, 1)
btk = UBound(Myarr, 2)
ReDim Preserve btb(0)
btb(0) = 1
For i = 1 To btc
