|
这个是我最后修改的代码,请蓝版主和楼主给看看,万分感谢!!
Sub 保存问卷网加减一试卷()
Dim rng As Range, i, bi, h, ye
Dim ad$, m&, mc$, shp As Shape
Dim nm$, n&, myFolder$
Sheets("1").Activate
ye = 1
bi = 14
n = 0
For h = 1 To 3
For i = 1 To 10
myFolder = ThisWorkbook.Path & "\问卷网全国比赛试卷\" '指定文件夹名称
Set rng = Range(Cells((8 + ((h - 1) * bi + (h - 1) * 2)), (i)), Cells((h * bi + (h - 1) * 2 + 7), (i)))
rng.Select
Selection.Copy
ActiveSheet.Pictures.Paste
For Each shp In ActiveSheet.Shapes
If shp.Type = 13 Then
If Len(Dir(myFolder, vbDirectory)) = 0 Then
MkDir myFolder
End If
n = n + 1
ad = shp.TopLeftCell.Address
m = shp.TopLeftCell.Row
nm = "加减C组" & ye & h & Replace(Replace(rng.Address, "$", ""), ":", "-") & ".jpg"
shp.CopyPicture
With ActiveSheet.ChartObjects.Add(0, 0, shp.Width, shp.Height).Chart
.Parent.Select '必须要选择父对象chartojbect之后再粘贴,这样才能真正的粘上去。
.Paste
.Export myFolder & nm, "JPG"
.Parent.Delete
End With
shp.Delete
End If
Next
Next
Next
Sheets("自动出题系统").Select
End Sub |
|