Macro tirar print
Enviado: 29 Mar 2016 às 12:01
Pessoal estou procurando uma macro que possa tirar uma print de uma determinada area e que possa colar na area de trabalho , estava tentando uma que vi na internet porem a qualidade sai pessima.
Sub Salva_Range_Como_Imagem()
'http://tech.groups.yahoo.com/group/ms_e ... sage/38865
' =========================================
' Code to save selected Excel Range as Image
' adjusted by Pascal Daulton 15-Sep-2011
'Readaptado em 16-09-2011 por RLM
' =========================================
Dim sRange As Range
Dim oCht As Chart
Dim oImg As Picture
Dim sPath As String, rRange As String
sPath = ThisWorkbook.Path
'Acrescenta a barra invertida "\"; se necessaria
If Right(sPath, 1) <> "\" Then
sPath = sPath & "\"
Else
sPath = sPath
End If
Set sRange = Application.InputBox(prompt:= _
"Selecione o intervalo a ser copiado", _
Title:="Lê Intervalo", Type:=8)
If sRange.Address = "" Then
MsgBox "Sem informação da range"
Exit Sub
End If
With sRange
.CopyPicture xlScreen, xlPicture
Set oCht = ActiveSheet.ChartObjects.Add(50, 50, .Width + 5, .Height + 5).Chart
End With
With oCht
.Paste
.Shapes(1).Left = -.ChartArea.Left
.Shapes(1).Top = -.ChartArea.Top
.Parent.Width = sRange.Width
.Parent.Height = sRange.Height
.Export Filename:=sPath & "AreaSalva.gif", Filtername:="gif"
.Parent.Delete
End With
End Sub
Sub Salva_Range_Como_Imagem()
'http://tech.groups.yahoo.com/group/ms_e ... sage/38865
' =========================================
' Code to save selected Excel Range as Image
' adjusted by Pascal Daulton 15-Sep-2011
'Readaptado em 16-09-2011 por RLM
' =========================================
Dim sRange As Range
Dim oCht As Chart
Dim oImg As Picture
Dim sPath As String, rRange As String
sPath = ThisWorkbook.Path
'Acrescenta a barra invertida "\"; se necessaria
If Right(sPath, 1) <> "\" Then
sPath = sPath & "\"
Else
sPath = sPath
End If
Set sRange = Application.InputBox(prompt:= _
"Selecione o intervalo a ser copiado", _
Title:="Lê Intervalo", Type:=8)
If sRange.Address = "" Then
MsgBox "Sem informação da range"
Exit Sub
End If
With sRange
.CopyPicture xlScreen, xlPicture
Set oCht = ActiveSheet.ChartObjects.Add(50, 50, .Width + 5, .Height + 5).Chart
End With
With oCht
.Paste
.Shapes(1).Left = -.ChartArea.Left
.Shapes(1).Top = -.ChartArea.Top
.Parent.Width = sRange.Width
.Parent.Height = sRange.Height
.Export Filename:=sPath & "AreaSalva.gif", Filtername:="gif"
.Parent.Delete
End With
End Sub