#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default KeyCode

The keys on a keyboard are assigned with 'KeyCode'. Is there a KeyCode for
'PrtScr'? I cannot seem to find this KeyCode. If there is no such KeyCode,
can VBA codes detect when the 'PrtScr' key is pressed?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default KeyCode

The KeyCode constant is vbKeyPrint for the Print Screen key.

"Francis Ang" wrote:

The keys on a keyboard are assigned with 'KeyCode'. Is there a KeyCode for
'PrtScr'? I cannot seem to find this KeyCode. If there is no such KeyCode,
can VBA codes detect when the 'PrtScr' key is pressed?

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default KeyCode

Hi,
If you want to capture the screen, maybe more simple if use
API calls :
Option Explicit

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

Sub PRTSCR()
keybd_event VK_SNAPSHOT, 1, 0, 0
End Sub

Rgds,

Halim

"Francis Ang" wrote:

The keys on a keyboard are assigned with 'KeyCode'. Is there a KeyCode for
'PrtScr'? I cannot seem to find this KeyCode. If there is no such KeyCode,
can VBA codes detect when the 'PrtScr' key is pressed?

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default KeyCode

I'm guessing this is connected to the OP's previous request to prevent
PrtScr rather than call it.

NickHK

"Halim" wrote in message
...
Hi,
If you want to capture the screen, maybe more simple if use
API calls :
Option Explicit

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

Sub PRTSCR()
keybd_event VK_SNAPSHOT, 1, 0, 0
End Sub

Rgds,

Halim

"Francis Ang" wrote:

The keys on a keyboard are assigned with 'KeyCode'. Is there a KeyCode

for
'PrtScr'? I cannot seem to find this KeyCode. If there is no such

KeyCode,
can VBA codes detect when the 'PrtScr' key is pressed?

Thanks.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default KeyCode

Thanks a lot guys for all your help.

Just for your information, I have managed to circumvent the 'PrtScr' issue
by using a timer and clear clipboard procedures.

"NickHK" wrote:

I'm guessing this is connected to the OP's previous request to prevent
PrtScr rather than call it.

NickHK

"Halim" wrote in message
...
Hi,
If you want to capture the screen, maybe more simple if use
API calls :
Option Explicit

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

Sub PRTSCR()
keybd_event VK_SNAPSHOT, 1, 0, 0
End Sub

Rgds,

Halim

"Francis Ang" wrote:

The keys on a keyboard are assigned with 'KeyCode'. Is there a KeyCode

for
'PrtScr'? I cannot seem to find this KeyCode. If there is no such

KeyCode,
can VBA codes detect when the 'PrtScr' key is pressed?

Thanks.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default KeyCode

Can you post the code.

NickHK

"Francis Ang" wrote in message
...
Thanks a lot guys for all your help.

Just for your information, I have managed to circumvent the 'PrtScr' issue
by using a timer and clear clipboard procedures.

"NickHK" wrote:

I'm guessing this is connected to the OP's previous request to prevent
PrtScr rather than call it.

NickHK

"Halim" wrote in message
...
Hi,
If you want to capture the screen, maybe more simple if use
API calls :
Option Explicit

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

Sub PRTSCR()
keybd_event VK_SNAPSHOT, 1, 0, 0
End Sub

Rgds,

Halim

"Francis Ang" wrote:

The keys on a keyboard are assigned with 'KeyCode'. Is there a

KeyCode
for
'PrtScr'? I cannot seem to find this KeyCode. If there is no such

KeyCode,
can VBA codes detect when the 'PrtScr' key is pressed?

Thanks.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default KeyCode

Here is the code ...

Declare Function CloseClipboard Lib "user32" () As Long
Declare Function EmptyClipboard Lib "user32" () As Long
Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long

Public RunWhen As Double
Public Const cProc = "ClrSub"

Sub ClearClipboard()
OpenClipboard 0&
EmptyClipboard
CloseClipboard
End Sub

Sub StartTimer()

RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime earliesttime:=RunWhen, procedu=cProc, _
schedule:=True

End Sub


Sub ClrSub()

ClearClipboard
StartTimer

End Sub


"NickHK" wrote:

Can you post the code.

NickHK

"Francis Ang" wrote in message
...
Thanks a lot guys for all your help.

Just for your information, I have managed to circumvent the 'PrtScr' issue
by using a timer and clear clipboard procedures.

"NickHK" wrote:

I'm guessing this is connected to the OP's previous request to prevent
PrtScr rather than call it.

NickHK

"Halim" wrote in message
...
Hi,
If you want to capture the screen, maybe more simple if use
API calls :
Option Explicit

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

Sub PRTSCR()
keybd_event VK_SNAPSHOT, 1, 0, 0
End Sub

Rgds,

Halim

"Francis Ang" wrote:

The keys on a keyboard are assigned with 'KeyCode'. Is there a

KeyCode
for
'PrtScr'? I cannot seem to find this KeyCode. If there is no such
KeyCode,
can VBA codes detect when the 'PrtScr' key is pressed?

Thanks.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keycode description creator Beeatrice Excel Discussion (Misc queries) 1 November 12th 09 02:08 AM
TextBox and KeyCode Darrin Henshaw Excel Programming 7 April 26th 05 06:57 PM
detecting keycode internationally charlie Excel Programming 0 December 20th 04 09:42 PM


All times are GMT +1. The time now is 04:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"