2014-05-01 96 views

回答

1

here被盜無恥地(但測試)在宏:

Sub test() 
    Dim cht As Chart 
    With Range("A1:E10") 
    .CopyPicture Appearance:=xlScreen, Format:=xlPicture 
    Set cht = ActiveSheet.ChartObjects.Add(10, 10, .Width, _ 
    .Height).Chart 
    End With 
    cht.Paste 
    cht.ChartArea.Border.LineStyle = 0 
    On Error Resume Next 
    Kill "testChart.jpg" 
    On Error GoTo 0 
    cht.Export "testChart.jpg", "jpg" 
    cht.Parent.Delete 
End Sub 

我假設你的意思是選擇Range,而不是窗口,否則按鍵就會做。我們需要用Selection來代替Range("A1:E10"),並在錯誤檢查中包裝它,因爲Selections are a little risky

相關問題