Sub ExportPrintAreaAsImage()
Dim ws As Worksheet
Dim printArea As Range
Dim pageBreak As Range
Dim i As Integer
Dim savePath As String
' 设置保存路径
savePath = "C:\Temp\"
' 循环遍历每个工作表
For Each ws In ThisWorkbook.Worksheets
' 获取当前工作表的打印区域
Set printArea = ws.PageSetup.PrintArea
If Not printArea Is Nothing Then
' 循环遍历每个分页符
For i = 1 To ws.HPageBreaks.Count + 1
' 获取当前分页符之前的打印区域
If i = 1 Then
Set printArea = ws.Range(printArea.Cells(1), ws.HPageBreaks(i).Location.Offset(-1))
Else
Set printArea = ws.Range(ws.HPageBreaks(i - 1).Location.Offset(1), ws.HPageBreaks(i).Location.Offset(-1))
End If
Sub ExportPrintAreaAsImage()
Dim ws As Worksheet
Dim printArea As String
Dim pageBreak As Range
Dim i As Integer
Dim savePath As String
' 设置保存路径
savePath = "C:\Temp\"
' 循环遍历每个工作表
For Each ws In ThisWorkbook.Worksheets
' 获取当前工作表的打印区域
printArea = ws.PageSetup.PrintArea
If Not printArea = "" Then
' 循环遍历每个分页符
For i = 1 To ws.HPageBreaks.Count + 1
' 获取当前分页符之前的打印区域
If i = 1 Then
Set printRange = ws.Range(printArea).Resize(ws.HPageBreaks(i).Location.Row - 1 - ws.Range(printArea).Row)
Else
Set printRange = ws.Range(ws.HPageBreaks(i - 1).Location.Offset(1)).Resize(ws.HPageBreaks(i).Location.Row - 1 - ws.Range(ws.HPageBreaks(i - 1).Location.Offset(1)).Row)
End If