hello forum,
i've made an VBA tool that would take the printscreen of the previous active window and copy it into Excel using Sendkeys
the program is running perfect on XP but fails big time on Vista.
do you know if there is anything specific with Vista that would have an effect on the Sendkey method?
any tips or information is greatly appreciated.
here is the code:
Uploaded with ImageShack.us
i've made an VBA tool that would take the printscreen of the previous active window and copy it into Excel using Sendkeys
the program is running perfect on XP but fails big time on Vista.
do you know if there is anything specific with Vista that would have an effect on the Sendkey method?
any tips or information is greatly appreciated.
here is the code:
Uploaded with ImageShack.us
Code:
Sub all_print_screens()
Call a 'moves to the previous window
Call B 'print screen previous window
Call D 'goes back to last excel file opened
Call E ''copy current print screen in the first row after the previous print screen
'Call f 'inserts the username, time stamp and default values & dropdown lists
End Sub
Sub a()
'moves to the previous window
'ALT+Tab - cauta pe net SENDKeys
Application.SendKeys "%{TAB}", True
DoEvents
Application.Wait (Now + 0.000005)
End Sub
Sub B()
'print screen previous window
'Application.SendKeys "{PRTSC}"
Application.SendKeys "(%{1068})", True ' printscreen
DoEvents
Application.Wait (Now + 0.000001)
DoEvents
End Sub
Sub c()
'move to Excel tool
'ALT+Tab - cauta pe net SENDKeys
'Application.SendKeys "{%TAB}"
End Sub
Sub D()
'goes back to last excel file opened ; [here will be the Excel file containing the macro
'AppActivate "Microsoft Excel"
'AppActivate Application.Caption
Application.SendKeys "%{TAB}"
DoEvents
Application.Wait (Now + 0.000001)
End Sub
Sub E()
'copy current print screen in the first row after the previous print screen
'Sub Find_Image_Range_In_Excel()
Dim rCount As Long
Dim shp As Shape
For Each shp In ActiveWorkbook.Worksheets(1).Shapes
If shp.BottomRightCell.Row > rCount Then rCount = shp.BottomRightCell.Row
On Error Resume Next
Next
Sheets(1).Activate
Cells(rCount + 7, 1).Select
ActiveSheet.Paste
end sub