Copying a portion of a picture

Puertorekinsam

Board Regular
Joined
Oct 8, 2005
Messages
236
I have another odd request that I hope someone out there can help me with.

is there a way in VBA to copy a portion of an image to the clipboard?

I have an image that appears on multiple tabs of my workbook, and I was able to use one JPEG on a hidden tab and load the image into an image box on the various tabs during worksheet activate and then clear them out when the tab deactivated. This worked great for decreasing file size.

Now I would like to use a simmilar process to take a map of my store (Luckily a large square location) and copy out just a section of the map to put in an image box.

I would think some sort of case statement to determin the top, left, width and height of the section of the image to be coppied would be needed. but I'm not sure if it can be done.

Thanks!
 

Puertorekinsam

Board Regular
Joined
Oct 8, 2005
Messages
236
Was able to solve this by using a the crop commands

If nodot = False Then
PercentToCropb = (34 - topcrop) / 34
PercentToCropt = (topcrop - 1) / 34
Set shapeToCrop = Sheet100.Shapes("TheLedge")
With shapeToCrop.Duplicate
.ScaleHeight 1, True
origHeight = .Height
cropPoints = origHeight * PercentToCropb
.PictureFormat.CropBottom = cropPoints
cropPoints = origHeight * PercentToCropt
.PictureFormat.CropTop = cropPoints
.Name = "TempPic"
End With
End If
 

Forum statistics

Threads
1,081,798
Messages
5,361,366
Members
400,628
Latest member
teresajm

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top