ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   trying to use print screen. (https://www.excelbanter.com/excel-programming/380578-re-trying-use-print-screen.html)

musa.biralo

trying to use print screen.
 
Thanks Thanks and Thanks Nick
you are the man!

This is what i want .....well to be honest..i don't understand your
first part but i will try to understand.....

Many many thanks

musa.biralo

NickHK wrote:
This seems to works in Excel although there some inconsistencies if
- The VBE window is under the Excel window
- Excel is not always returned with focus; so Appactivate
Your should add error trapping also. As the API call has no return value for
success, you cannot tell if there is anything valid to PasteSpecial until
you try.

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Const VK_SNAPSHOT = &H2C

Private Sub CommandButton1_Click()
Dim PrevState As XlWindowState

PrevState = Application.WindowState
Application.WindowState = xlMinimized

keybd_event VK_SNAPSHOT, 0, 0, 0

Application.WindowState = PrevState
'Excel is not always returned with focus, so
AppActivate Application.Caption

With ActiveSheet
.Range("A1").Select
.PasteSpecial Format:="Bitmap"
End With

End Sub

NickHK

"musa.biralo" wrote in message
oups.com...
Hi,
I am trying to,
1) Minimize the excel.
2) Press "Print Screen"
3) Come back to same excel.
4) Paste it in the excel

Problem is how can i send the Print Screen command...when excel is
minimized there could be any application running.....

Your help will highly be appreciated.
Thanks

musa.biralo




All times are GMT +1. The time now is 10:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com