my project is to use VBA to enter function in BBG and take the screen shot back to excel. I have several functions need to be checked. If i only include one function per time, it works. But if i add one more, i can only see the last screenshot.
Here is the code:
Option Explicit
Global bbgCom As BBSend
Public mn As Worksheet
Sub Deleteticker()
Dim i As Long
If bbgCom Is Nothing Then Set bbgCom = New BBSend
Set mn = Worksheets("Main")
Cells(4, 1) = "HDDB"
' send request to Bloomberg
' re-activate excel
AppActivate ThisWorkbook.Name
' wait for Bloomberg response
Application.Wait Now + TimeValue("00:00:05")
'start screenshot and paste
mn.Range("A5").Select
AltPrintScreen
Application.SendKeys "^v"
End Sub
'AltPrintScreen
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 KEYEVENTF_KEYUP = &H2
Private Const VK_SNAPSHOT = &H2C
Private Const VK_MENU = &H12
Sub AltPrintScreen()
keybd_event VK_MENU, 0, 0, 0
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
And another question, if i replace the sendkeys with activesheet.paste, the screenshot i get is not the latest screenshot. Thank you for help in advance.
Bookmarks