Imagen de rango que no aparezcan las columnas ocultas VBA

Estimad@s:

Espero me puedan ayudar. Trataré de explicar de lo mejor posible.

Quiero sacar una imagen desde un rango desde A hasta L, pero entre A y L hay columnas ocultas y cuando dicha imagen salga quiero que NO aparezcan las columnas ocultas, ¿cómo puedo realizar esto?.

Dejo el método que utilizo. Cabe destacar que el rango lo tengo en el administrador de nombres referenciado a una formula que tiene un rango dinamico.

Llamada botón:

Call CrearImagenesRangos("INFORME", "RNOVEDADES", "B3", 25, 440, 1.7)

la método que realiza la imagen es el siguiente:

Function CrearImagenesRangos(hoja As String, rango As String, pos As String, alto As Double, ancho As Double, mov As Double)

'Worksheets(hoja).PivotTables(TablaDinamica).PivotSelect "", xlDataAndLabel

Worksheets("DETENCIONES").Select
Worksheets("DETENCIONES").Range(rango).Select

Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture ' xlBitmap '
ActiveSheet.PasteSpecial Format:="Imagen (metarchivo mejorado)", Link:= _
False, DisplayAsIcon:=False
Selection.Cut
Worksheets("INFORME").Activate
Range(pos).Select
Worksheets("INFORME").Paste
Selection.ShapeRange.LockAspectRatio = msoFalse 'Bloquea proporcionalidad imagen
Selection.ShapeRange.Height = alto
Selection.ShapeRange.Width = ancho

Selection.ShapeRange.IncrementLeft mov

Application.CutCopyMode = False
Range("a1").Select

End Function

Lo anterior afecta la imagen que aparece porque ocupa mucho tamaño. Y quiero resolverlo ocultando ciertas columnas.

1 Respuesta

Respuesta
1

Bueno luego de mucho investigar, pude armar de varios códigos lo que necesitaba.

Sheets("INFORME").Select
Dim objPic As Shape
Dim objChart As Chart
Call Sheets("DETENCIONES").Range("A1:L" & cantidaddetenciones).CopyPicture(xlScreen, xlPicture)
Sheets("INFORME").Range("b3").PasteSpecial
Selection.ShapeRange.LockAspectRatio = True
Selection.ShapeRange.Height = Sheets("DETENCIONES").Range("A1:L" & cantidaddetenciones).Height + 5
Selection.ShapeRange.Width = 447
Selection.ShapeRange.IncrementLeft 0
Sheets("INFORME").Shapes.Item(1).Line.Visible = msoFalse
Selection. ShapeRange. IncrementLeft 2

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas