2
I need to copy a track from an Excel spreadsheet that contains a graphic scheme made with borders around some cells, with some background colors and text, and view this scheme in a VBA "image" object.
With the code below the range of cells that composes the figure is copied from the current spreadsheet to another name "Image", and is copied as image (as accurate), but I could not get a way to put it in the object "image", or even to paste it directly in the object "image" (so the spreadsheet "Image" would be unnecessary).
Range("D19:H25").Select
Application.CutCopyMode = False
Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
Sheets("Imagem").Activate
Range("A1").Select
ActiveSheet.Paste
In an attempt to find a solution, by manually selecting the cells containing the image, and in "Home", "Copy as image" (appearance: as shown on screen, and format: Bitmap); by clicking on properties of the "image" object in the "Picture" field where it is described "none" and give "paste" in this field, appears the word "Bitmap" and in the object "image" appears the image as desired.
I tried and researched automate this same procedure in VBA, including doing it by macro and analyzing the code, but evidently the code of the part that the deviation is made to the VBA to "paste" the track selected in the property of the object (Picture) is not recorded in the macro.
As the graphic scheme is changed dynamically by the user (via VBA), whenever the user enters a given form this object "image" needs to present the current image, as many times as the user wants to refine this image.
How to fix it the way I need to?
Possible duplicate of Save an image pasted in Excel spreadsheet through VBA
– Luiz Vieira
The other question deals with "how to save the image in a file", while this question deals with "how to take an image and place it in a VBA image object", are two different problems for handling the same image
– Leo
Okay, I saw the issue you did. I withdrew my vote to close as duplicate.
– Luiz Vieira