Copying a portion of a picture

Puertorekinsam

Active Member
Joined
Oct 8, 2005
Messages
293
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!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,142
Members
448,551
Latest member
Sienna de Souza

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top