Click here to Skip to main content
15,887,444 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have written a macro (Word 2003) to capture the screen.
Code is as below:
VB
Sub PrintScreen()
 keybd_event VK_SNAPSHOT, 0, 0, 0
 keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
 keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
End Sub

To paste the captured screen below loop has written
VB
Do Until A = True
  PrintScreen
  Selection.Paste
Loop

This code is working fine when the word document is opened, but if I opened browser when the loop is going on I'm getting below error message.
'Run Time Error:4605 - This method or property is not available because the clipboard empty or not valid '

Can someone help me to solve this issue?

Thanks
Posted
Updated 26-Feb-12 3:51am
v2
Comments
André Kraak 26-Feb-12 9:52am    
Edited question:
Added pre tags
"Treat my content as plain text..." option disabled.

1 solution

I never worked in VBA. But I found this solved thread for the same error, check it
Run-time error '4605': This method or property is not available because the Clipboard is empty or not valid.[^]
&
couple of related links for this error[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900