- 帖子
- 12
- 主題
- 4
- 精華
- 0
- 積分
- 16
- 點名
- 0
- 作業系統
- execl
- 軟體版本
- 2003
- 閱讀權限
- 10
- 註冊時間
- 2015-12-20
- 最後登錄
- 2021-3-8
|
Private Sub CommandButton1_Click()
Range("A2:i48").Select
Range("I1").Activate
Dim Newshape As Shape
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
ActiveSheet.Paste
Set Newshape = ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
With ActiveSheet.ChartObjects.Add(1, 1, 1, 1)
.Width = Newshape.Width
.Height = Newshape.Height
Newshape.Copy
.Chart.Paste
.Chart.Export ActiveWorkbook.Path & "\a1.jpg"
.Delete
End With
Newshape.Delete
MsgBox "恭喜!圖片已生成並存放在" & ActiveWorkbook.Path
End Sub
此原碼只能存一頁a1.jpg 如果頁次很多就很麻煩,
表格第一頁是(A2:I48) 存檔為A1.JPG
表格第二頁是(A49:I95)存檔為A2.JPG
表格第三頁是(A96:I142)存檔為A3.JPG
表格第四頁是(A143:I189)存檔為A4.JPG
依表格多寡存成JPG檔 麻煩老師解答 |
|