Sometimes we need to have printed paper documentations for Bloomberg pricing sources used for valuations for each and every security in our bond books. Now, imagine that there are a few hundred bonds out there and you should print these screenshots one by one: by manually inserting every required parameter in Bloomberg screen and pressing print. Frankly said, this would be more than time-expensive and tedious task, and definitely not something I would like to be involved with. However, I have to be involved. How could I outsource this process for a machine?
Fortunately, there is one approach what you can use in VBA: Dynamic Data Exchange (DDE). DDE has its problems and in general, I try to avoid using it. However, it has its rare moments exactly for things like this. Instead of doing this process manually, I have a program which reads a list of required parameters and then prints out price documentations one by one by using DDE.
The point in my example given below is, that you will get the basic idea how you could use DDE for this particular type of problem. Then, you can work for developing your own solution. You can copy-paste the following program into a new VBA Standard Module.
Note: for this program you need to have active Bloomberg licence in your machine.
As you can see, the beef is inside createExecutionString function which creates executionString for DDEExecute function. When you open any Bloomberg function (say, SWPM<GO> for example), you can set up input values for all required argument fields by
1) clicking a field active with your mouse and then writing a value into a field
2) moving with keyboard TAB and then writing a value into a field
As you can see in createExecutionString function, it uses the latter approach by moving with keyboard TAB and then writing a value into a field. If you run that test program, you will see that it actually does all of this: moving with cursor in fields and writing a value. It's like that macro what you can record in your Bloomberg.
Anyway, I hope that you would find this post to be helpful and it could help you to solve your problem. Have a great start for June!