- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
5#
發表於 2014-4-25 09:43
| 只看該作者
回復 4# li_hsien
我的是2003版,執行附檔程式碼是2003版以上版本寫的.
錯誤點都是 "不支援此屬性或方法" ,可以標出錯誤點是哪裡,看看如何解決- Sub A_chart(w_file)
- 'Dim C As ChartObject
- 'Set C = Workbooks(w_file).Worksheets(1).ChartObjects("Chart 3")
- With Workbooks(w_file).Worksheets(1).ChartObjects("Chart 3").Chart
- '.ChartArea.Format.Line.Visible = msoFalse '2003錯誤
- .ChartArea.Border.LineStyle = msoFalse '改成這樣對嗎?
- .SizeWithWindow = True
- '.ChartArea.Width = 362.5 '寬度 原1449.25 '2003錯誤
- '.ChartArea.Height = 124.75 '高度 原178.75 '2003錯誤
- .Parent.Width = 362.5 ' *** 這樣對嗎? ***
- .Parent.Height = 124.75
-
- With .PlotArea
- .Height = 102.148661417323 '繪圖區高度 原120.97031496063
- .Width = 342.872283464567 '繪圖區寬度 原358.980866141732
- .Left = 10 '繪圖區位移
- .Top = 10 '繪圖區位移
- End With
- '圖表標題
- With .ChartTitle
- If IsError(Application.Find(".", Worksheets(2).Range("G2"))) = False Then
- .Text = Left(ActiveChart.ChartTitle.Text, Application.Find(" ", ActiveChart.ChartTitle.Text) - 1) _
- & "-" & Mid(Worksheets(2).Range("G2"), Application.Find(".", Worksheets(2).Range("G2"), Application.Find(".", Worksheets(2).Range("G2")) + 1) + 1, 3) _
- & " " & "wk" & Right(Worksheets(2).Range("A2"), 4) & " " & Right(ActiveChart.ChartTitle.Text, 15)
- ElseIf IsError(Application.Find(".", Worksheets(2).Range("G2"))) = True Then
- .Text = Left(ActiveChart.ChartTitle.Text, Application.Find(" ", ActiveChart.ChartTitle.Text) - 1) _
- & "-" & Mid(Worksheets(2).Range("G2"), Application.Find("_", Worksheets(2).Range("G2"), Application.Find("_", Worksheets(2).Range("G2")) + 1) + 1, 3) _
- & " " & "wk" & Right(Worksheets(2).Range("A2"), 4) & " " & Right(ActiveChart.ChartTitle.Text, 15)
- End If
- .Font.Size = 6.5 '標題字體大小
- .Font.Name = "Arial" '標題字型
- .Left = 123 '標題位移
- End With
- With .Legend
- .Position = xlLegendPositionBottom '圖例列底部
- '.Legend.Top = 300 '圖例位移
- .Top = Range("A21").Top
- .Font.Size = 6.5 '圖例字體大小
- .Font.Name = "Arial" '圖例字型
- End With
- With .SeriesCollection("Yield")
- ' .SeriesCollection(4).Border.ColorIndex = 18 '線條顏色
- .Border.Color = 5066944 '線條顏色
- '.SeriesCollection("Yield").Format.Line.Weight = 1 '線條&標記寬為1
- '.Format.Line 2003錯誤 ***********
- .Border.Weight = 1 '.LineStyle = 0
- .Border.Weight = -4138 '只改變線條
- .MarkerStyle = 2 '標記菱形
- .MarkerBackgroundColorIndex = 2 '標記顏色(白)
- .MarkerSize = 5 '標記大小5
- .MarkerForegroundColor = 5066944 '標記外框
- .ApplyDataLabels '顯示資料標籤
- .DataLabels.Font.Size = 5 '上列數值字體大小
- .DataLabels.Font.Name = "Arial" '上列數值字型
-
- End With
- '.SeriesCollection("Yield").Select '不需要
- ' .SetElement (msoElementDataLabelTop) '資料標籤置上 '2003沒這選項
- .Axes(xlValue, xlPrimary).AxisTitle.Font.Size = 6.5 'Y軸標題大小
- .Axes(xlValue, xlPrimary).AxisTitle.Font.Name = "Arial" 'Y軸標題字型
- .Axes(xlValue, xlPrimary).AxisTitle.Left = -3 'Y軸標題位移
- .Axes(xlCategory).TickLabels.Font.Size = 5 'X軸字體大小
- .Axes(xlCategory).TickLabels.Font.Name = "Arial" 'X軸字型
-
- .Axes(xlValue).TickLabels.Font.Size = 6.5 'Y軸字體大小
- .Axes(xlValue).TickLabels.Font.Name = "Arial" 'Y軸字型
-
- .SeriesCollection("Yield").DataLabels.Font.Size = 5 '上列數值字體大小
- .SeriesCollection("Yield").DataLabels.Font.Name = "Arial" '上列數值字型
- End With
- End Sub
複製代碼 |
|