| 
    
     |  | エクセル・ブックを通常、保存しているフォルダーに "MyPic" と連番を組み合わせた ファイル名の Gifファイル を作成・保存するコードとして・・
 
 Sub Mk_MyPic()
 Dim MyF As String, NewF As String
 Dim i As Long
 
 With Worksheets("Sheet1").Pictures
 If .Count = 0 Then Exit Sub
 .Item(.Count).Select
 End With
 With Application
 .ScreenUpdating = False
 .DisplayAlerts = False
 MyF = Dir(.DefaultFilePath & "\MyPic*.gif")
 If MyF = "" Then
 NewF = .DefaultFilePath & "\MyPic1.gif"
 Else
 i = 1
 Do Until MyF = ""
 i = i + 1: MyF = Dir()
 Loop
 NewF = .DefaultFilePath & "\MyPic" & i & ".gif"
 End If
 End With
 Selection.Copy
 With Charts.Add
 .Paste
 .Export NewF, "GIF"
 .Delete
 End With
 With Application
 .ScreenUpdating = True
 .DisplayAlerts = True
 End With
 MsgBox Dir(NewF) & " を作成・保存しました", 64
 End Sub
 
 |  |