Saving a picture of the screen to disk

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
9,806
Office Version
  1. 2016
Platform
  1. Windows
Hi there,

Is it possible to take a picture of a section of the screen programmatically? if so, how would I , for example, save the Top Right section of the current screen to disk ? the screen section should be determinated with screen coordinates.

Regards.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Ok, I realise that wanting to get a picture of some section of the screen sounds a bit vain if not weird. so let me tell you why i need this.

My real problem is as follows:

I have an oval autoshape placed on a worksheet. The autoshape's background is transparent so i can see through the cells underneath which contain some figures.

When i copy the autoshape i want the underneath cells to be copied a long with it as well . They don't. I just get a copy of the transparent autoshape but without a copy of the cells.

To get around this i thought maybe i should take a picture of the screen region delimiting the autoshape bounderies hence copying all that is on display in that screen region including the background cells.

Copying the underneath cells first then placing the autoshape copy over them wouldn't work for me as the shape is an oval and i ill be using this picture taking repetitively in a timer.

Open to any suggestions .

Regards.
 
Upvote 0
Thanks Ivan.

Your workbook example uses the clipboard to to get a pointer to the copied selection. It doesn't work for my specific requirement as the underneath cells won't be selected.

If the autoshape was a rectangle, i think i could use the BitBlt function to copy the rectangle Rect onto a memory DC and from there get a pointer to the its picture.

I am experimenting with a transparent autoshape rectangle . If I come up with something that works, i'll post it

Again, thanks for your help.

Regards.


late edit: i've just searched the forum and found this by Tom :http://www.mrexcel.com/board2/viewtopic.php?t=202546&highlight=bitblt . it may be of interest.
 
Upvote 0
Could you explain a bit more about your project?

Is it not possible to select the region of cells beneath the AutoShape ?
as that would be simplest method.
 
Upvote 0
Could you explain a bit more about your project?

Is it not possible to select the region of cells beneath the AutoShape ?
as that would be simplest method.

Ivan, my ultimate goal is to make a "Magnifying Glass" that the user could freely move over the worksheet and Zoom-In the current region under the glass. That is what I am actually after.Hence the idea to use a transparent oval shape combined with a timer.

I thought maybe the magnifying glass could be made out of a copy of another transparent autoshape in a second window of the same worksheet but with a bigger Zoom ratio. So as the user moves the Glass autoshape say over the range A1:B4, the transparent autoshape moves over the same range in the Zoomed window at the same time using a timer and updates what you see in the magnifying glass .


I hope i am not confusing this further and apologise for rambling around and not being clear about what i am really trying to accomplish.

Anyway, I am open to any suggestions and in the end, I might as well just have to rethink the whole design/logic in order to achieve this "Magnifying Glass" stuff.

Regards.
 
Upvote 0
Ah, yes I looked into this briefly a while ago ..... let's see what we can come up with, short of just calling up the Windows Applet that does this.

In fact you could just call this up and keep the Applet on top.
But this would be a good project :)
 
Upvote 0

Forum statistics

Threads
1,224,804
Messages
6,181,059
Members
453,016
Latest member
cherryfalling

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