andrewb90
Well-known Member
- Joined
- Dec 16, 2009
- Messages
- 1,077
Hello all,
I have a code that get a current screenshot and the pastes and centers in on the current screen, however, what I am trying to do is only get a screenshot of the cells and the grid. Not the headings,ribbon, excel bar, start menu, etc.
In other words, if I can see cells A1:R20 in my current view of the screen. When I do my screenshot, it would copy the image of those cells only and when it was pasted and centered it would be an identical picture of my current view. (You wouldn't know it was a picture until you clicked on it)
Any help would be greatly appreciated. (I hope I made my goal clear, btw)
I have a code that get a current screenshot and the pastes and centers in on the current screen, however, what I am trying to do is only get a screenshot of the cells and the grid. Not the headings,ribbon, excel bar, start menu, etc.
In other words, if I can see cells A1:R20 in my current view of the screen. When I do my screenshot, it would copy the image of those cells only and when it was pasted and centered it would be an identical picture of my current view. (You wouldn't know it was a picture until you clicked on it)
Code:
Sub CopyScreen()
Application.SendKeys "({1068})", True
DoEvents
ActiveSheet.Paste
Dim shp As Shape
With ActiveSheet
Set shp = .Shapes(.Shapes.Count)
End With
Selection.Name = "screen01"
Dim myPicture As Shape
Set myPicture = ActiveSheet.Shapes("screen01")
With ActiveWindow.VisibleRange
myPicture.Top = .Top + .Height / 2 - myPicture.Height / 2
myPicture.Left = .Left + .Width / 2 - myPicture.Width / 2
End With
myPicture.Visible = True
End Sub
Any help would be greatly appreciated. (I hope I made my goal clear, btw)