poolhall
Active Member
- Joined
- Jan 9, 2009
- Messages
- 350
I use Excel 2007 and Vista 64bit, if it matters.
When I use AppActivate statement, it acts erratically. For some applications it doesn't work at all, for some it works in 60% of the time, and for others it works perfectly.
For example, I have this code which saves a screenshot as an image:
So, AppActivate "IrfanView" works fine at all times. AppActivate "Paint" doesn't want to work at all whatever I do, e.g. change "Paint" for "Untitled - Paint", "mspaint", AppActivate RetVal, AppActivate Application.Caption, nothing works!
And I have another piece of code where I use AppActivate "FireFox" statements, and this works from about 50 to 60% of the time.
This really drives me crazy. Do you have any suggestion?
When I use AppActivate statement, it acts erratically. For some applications it doesn't work at all, for some it works in 60% of the time, and for others it works perfectly.
For example, I have this code which saves a screenshot as an image:
Code:
Sub GetRating()
Dim RetVal
With Sheets("Rating")
.Columns("B:M").EntireColumn.AutoFit
.Range("A1:N32").Copy
End With
'RetVal = Shell("C:\Windows\system32\mspaint.exe", vbMaximizedFocus)
RetVal = Shell("C:\Program Files (x86)\IrfanView\i_view32.exe", 1)
'AppActivate "Untitled - Paint" '<--- this doesn't work
AppActivate "IrfanView" '<---- this works perfectly
Application.SendKeys ("^v"), True
Application.SendKeys ("s"), True
Application.SendKeys ("C:\Users\AccountName\Documents\Totalizator\" & ThisWorkbook.Name), True
Application.SendKeys ("~")
End Sub
And I have another piece of code where I use AppActivate "FireFox" statements, and this works from about 50 to 60% of the time.
This really drives me crazy. Do you have any suggestion?