Exportar múltiples imágenes simultáneamente a su libro de Excel con vba
publicado
Hola a todos, mi nombre es A.Maurizio
Y mi problema es este:
En una hoja de Excel tengo 6 (Formas) con el oro interno de las imágenes de Misceláneos.
Entonces encontré este listado en Internet:
VBA:
Opción explícita
Opción explícita
Sub Export_Images ()
Dim MyChart como cadena, MyPicture como cadena, oShape como variante
Dim PicWidth As Long, PicHeight As Long
Dim strImageName
Dim oDia
Dim oChartArea
Application.ScreenUpdating = False
En error GoTo finaliza
MyPicture = Selection.Name
Con seleccion
PicHeight = .ShapeRange.Height
PicWidth = .ShapeRange.Width
Terminar con
Charts.Add
ActiveChart.Location WHERE: = xlLocationAsObject, Name: = "Sheet1"
Selection.Border.LineStyle = 0
MyChart = Selection.Name & "" & Split (ActiveChart.Name, "") (2)
Con ActiveSheet
Con .Shapes (MyChart)
.Width = PicWidth
.Height = PicHeight
.copy
Terminar con
.Shapes (MyPicture) .copy
Con ActiveChart
' .ChartArea.Select
.Paste
Terminar con
.ChartObjects (1) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic1.jpg", FilterName: = "jpg"
.ChartObjects (2) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic2.jpg", FilterName: = "jpg"
.ChartObjects (3) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic3.jpg", FilterName: = "jpg"
.ChartObjects (4) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic4.jpg", FilterName: = "jpg"
.ChartObjects (5) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic5.jpg", FilterName: = "jpg"
.Shapes (MyChart) .cut
Terminar con
Application.ScreenUpdating = True
Subir de salida
acabado:
MsgBox "Debes seleccionar una imagen"
End Sub
Ahora hasta ahora, después de mi cambio personal; Parecía funcionar bien.
Excepto por un hecho:
1) Para exportar la imagen deseada; solo se debe seleccionar una imagen a la vez
¡Y no es bueno!
2) Además, en la Hoja de trabajo crea una copia de la imagen exportada.
E incluso aquí no es bueno.
Así que mi pregunta es esta:
No habría manera de exportar todas las imágenes al libro de trabajo cuando se presiona el botón; Sin tener que seleccionarlos siempre manualmente cada vez.
Entonces, tal vez usando un (OptionButton) me gustaría que pudieras decidir si las imágenes que transfiero a mi carpeta de llamadas (Objects_Images_Salted)
Estaban estables lo eliminé todo.
Graie por toda la ayuda que quieras darme al respecto.
Hi everyone, my name is A.Maurizio
And my problem is this:
On an Excel sheet I have 6 (Shapes) with the internal gold of the Miscellaneous images.
Then I found this listing on the Internet:
VBA:
Now So far, after my Personal Change; seemed to work well.
Except for one fact:
1) To Export the desired Image; only one image must be selected at a time
And it's not good!
2) In addition on the Worksheet creates a copy of the exported image.
And even here it's not good.
So my question is this:
There would be no way for all images to be exported to the workbook when the button is pressed; Without having to always select them manually every time.
Then maybe using a (OptionButton) I would like you to be able to decide if the images I transfer to my call folder (Objects_Images_Salted)
Were Stable I Eliminated Everything.
Graie for all the help you want to give me about it
Hola a todos, mi nombre es A.Maurizio
Y mi problema es este:
En una hoja de Excel tengo 6 (Formas) con el oro interno de las imágenes de Misceláneos.
Entonces encontré este listado en Internet:
VBA:
Opción explícita
Opción explícita Sub Export_Images () Dim MyChart como cadena, MyPicture como cadena, oShape como variante Dim PicWidth As Long, PicHeight As Long Dim strImageName Dim oDia Dim oChartArea Application.ScreenUpdating = False En error GoTo finaliza MyPicture = Selection.Name Con seleccion PicHeight = .ShapeRange.Height PicWidth = .ShapeRange.Width Terminar con Charts.Add ActiveChart.Location WHERE: = xlLocationAsObject, Name: = "Sheet1" Selection.Border.LineStyle = 0 MyChart = Selection.Name & "" & Split (ActiveChart.Name, "") (2) Con ActiveSheet Con .Shapes (MyChart) .Width = PicWidth .Height = PicHeight .copy Terminar con .Shapes (MyPicture) .copy Con ActiveChart ' .ChartArea.Select .Paste Terminar con .ChartObjects (1) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic1.jpg", FilterName: = "jpg" .ChartObjects (2) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic2.jpg", FilterName: = "jpg" .ChartObjects (3) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic3.jpg", FilterName: = "jpg" .ChartObjects (4) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic4.jpg", FilterName: = "jpg" .ChartObjects (5) .Chart.Export Nombre de archivo: = ThisWorkbook.Path & "Objects_Images_Salves MyPic5.jpg", FilterName: = "jpg" .Shapes (MyChart) .cut Terminar con Application.ScreenUpdating = True Subir de salida acabado: MsgBox "Debes seleccionar una imagen" End Sub
Ahora hasta ahora, después de mi cambio personal; Parecía funcionar bien.
Excepto por un hecho:
1) Para exportar la imagen deseada; solo se debe seleccionar una imagen a la vez
¡Y no es bueno!
2) Además, en la Hoja de trabajo crea una copia de la imagen exportada.
E incluso aquí no es bueno.
Así que mi pregunta es esta:
No habría manera de exportar todas las imágenes al libro de trabajo cuando se presiona el botón; Sin tener que seleccionarlos siempre manualmente cada vez.
Entonces, tal vez usando un (OptionButton) me gustaría que pudieras decidir si las imágenes que transfiero a mi carpeta de llamadas (Objects_Images_Salted)
Estaban estables lo eliminé todo.
Graie por toda la ayuda que quieras darme al respecto.
#############################################################
Hi everyone, my name is A.Maurizio
And my problem is this:
On an Excel sheet I have 6 (Shapes) with the internal gold of the Miscellaneous images.
Then I found this listing on the Internet:
VBA:
Now So far, after my Personal Change; seemed to work well.
Except for one fact:
1) To Export the desired Image; only one image must be selected at a time
And it's not good!
2) In addition on the Worksheet creates a copy of the exported image.
And even here it's not good.
So my question is this:
There would be no way for all images to be exported to the workbook when the button is pressed; Without having to always select them manually every time.
Then maybe using a (OptionButton) I would like you to be able to decide if the images I transfer to my call folder (Objects_Images_Salted)
Were Stable I Eliminated Everything.
Graie for all the help you want to give me about it
Esporta_Immagini.zip