I am currently trying to automate screenshot grabs from Bloomberg Terminal using DDE within VBA. Currently I have come up with a way to automatically pull screenshots by 'printing' through the Microsoft XPS Document Writer:
Dim ch As Variant
Dim CUSIP As String
CUSIP = Range("B12")
ch = DDEInitiate("winblp", "bbk")
Call DDEExecute(ch, "<blp-1>" & CUSIP & " mtge<GO>")
Call DDEExecute(ch, "<blp-1> DES<Go><print>")
Application.Wait Now + TimeValue("0:00:02")
Application.SendKeys "DES ", False
Application.SendKeys "{enter}", False
Call DDETerminate(ch)
The code seems to work fine on the first run, but then crashes the developer on each subsequent. Any feedback or further suggestions would be appreciated. Thanks!