簡體   English   中英

Excel VBA圖表軸錯誤:讀取`.ScaleType`時,“對象'Axis'的方法'ScaleType'失敗”

[英]Excel VBA chart axis error: “Method 'ScaleType' of object 'Axis' failed” when reading `.ScaleType`

我在Excel VBA宏中有一個作業

axscty = ax.ScaleType

出現錯誤:“對象'Axis'的方法'ScaleType'失敗”。 我發現資料來源指出這是Excel 2007中的錯誤。其他人在設置.ScaleType時發現了錯誤,例如,

.ScaleType = xlLinear

我發現了錯誤的原因:我有一個帶有數據序列的輔助Y軸。 如果我將這些系列分配給主要的Y軸並移除輔助的軸,則錯誤消失。

有誰知道如何避免出現輔助Y軸時的錯誤?

看起來像以下作品(無論您是否有輔助軸):

ActiveChart.SetElement (msoElementPrimaryCategoryAxisLogScale)
ActiveChart.SetElement (msoElementPrimaryValueAxisLogScale)
ActiveChart.SetElement (msoElementSecondaryCategoryAxisLogScale)
ActiveChart.SetElement (msoElementSecondaryValueAxisLogScale)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM