- 2008年5月15日 13:18
- Excel VBA | GraphControl
エクセルのシート上のグラフをGIF画像として保存するソースコードを紹介します。
This procedure will create GIF image of chart to selected folder.
下記のサンプルコードは、エクセルファイルのあるフォルダ内にシート上の一番若いグラフ(ChartObjects(1))を保存します。グラフ画像の名前は、グラフタイトルに設定しています。もしタイトルがない場合は、プログラムをイグジットして終了します。Chart クラスの "Export" メソッドを使用しています。他にも方法はあると思いますが、"Export" メソッドを使うのが一番手っ取り早い方法です。
The following sample code creates and saves ChartObjects (1) to a folder which is same path with current Excel file. The name of a graph image is set as a graph title. If no title, then program will exit. This code uses "Export" method of "Chart" Class.
GraphControl で使用しているコードです。
This source code is used in GraphControl.
Search