Click RefreshWorkbook on Bloomberg Ribbon [duplicate] - excel

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to refresh/load RTD Bloomberg function (BDH) in excel in vba
I am working on an Excel Spreadsheet with VBA. I have a Bloomberg BDH function that I want to refresh from VBA. I tried recording a macro and clicking the Bloomberg->Refresh Workbooks button but the macro came up empty. How can I do this from code? I'm using Excel 2007 and I found one option of entering
Application.Run "blpmain.xla!RefreshAllStaticData"
but blpmain.xla can't be found. I'm not sure what version of Excel/BBG-Addin this was for.
Any help?

What I ended up doing was re-pasting down the bloomberg formulas in the appropriate ranges. This forced the data to redownload. Not the most ideal solution but it works.

Basically, unlike BDP...BDH doesn't refresh because its historical(H), if you want refresh it you need to resubmit your formula.
Maybe not the most elegant solution but what I do is change something in the BDH formula. So you can click on a button you make that takes the data and adds a day and then removes it back. That slight change causes it to refresh.
Another thing I used to do was have a BDH bring in all the historical data, but have the top column a BDP realtime feed so it kept freshing.
In the end, the easiest way is to have the users close the excel sheet at the end of the day and have them reopen it when they need it.

Are you sure you've set a reference to the addin?
Open a code module in the workbook in which you want to use the
Add-In's functions
Go to Tools > References to open the References dialog where you
will see a list of all the libraries and other objects (like
Add-Ins) to which you can set a reference.
Put a tick in the box next to the name and click the OK button.
Source
Once you've done this, you can refer directly to the xla function RefreshAllStaticData.

Related

Excel VBA Slow Opening

We have an excel workbook (xlsm) which has an embedded VBA code, which looks up the distance between two points using the getgoogledistance module.
Since we have added this to the workbook, it take a very long time to open sometimes in excess of 10 minutes..
I suspect on opening the workbook, it is trying to update all of the entries, hence why it is slow to open.
Is there a way in which I could add a button to the worksheet and rather than on 'open' update the necessary cells, when this button is clicked it updated all the cells?
Yes, you need to go to the options, then customize menu and from the list on the right, check the Developer menu.
Back to Excel, you'll be able to add controls such as push buttons and attach macros to them.

vba excel: How to fill in two cells in a row with text

I need to make a header in my excel sheet using VBA. Seems pretty simple, but when I do this
Worksheets("New_Students").Range("A1").Value = "studentID"
Worksheets("New_Students").Range("B1").Value = "ISUID"
only the first line works and not the second one. What am I forgetting?
Try this:
Inside the excel application go to the developer tab on the ribbon and click record macro.
Type the values into the two cells manually.
Click stop recording and view the macro it created.
This would show you VBA code that will work and you can compare it to what you have in order to trouble shoot.
This is called recording a macro and can be very helpful in solving problems. In fact I would suggest doing so almost every time before asking a question here.

How to stop Bloomberg links updating in Excel

I am trying to use an Excel workbook that has links to Bloomberg data in. The data has been pulled from Bloomberg already. I then want to ensure that when I send this workbook to someone that they can use the sheet without a Bloomberg terminal connection. The user without the Bloomberg feed has set calculations to manual in Excel however when they try and save the workbook it automatically tries to update the fields and gives #NAME errors in the fields where Bloomberg values should be.
Is there a way to stop Excel from trying to refresh the Bloomberg links when the workbook is saved? I have tried VBA Workbook_AfterSave and Workbook_BeforeSave events but that did not seem to work.
A touch embarassed to admit but in Options > Formulas > Manual there is a check box for calculating the workbook before saving. I unchecked that and it worked.
According to the license, you're not supposed to remove values obtained using the API (Excel) from the computer where the Bloomberg Terminal is installed. That being said, if cells cease being Excel formulas they will no longer attempt to update to an up-to-date value. To do this, copy the cells that currently have a BDP/BDH formula and right click -> paste special -> values. This is also useful if you don't want the values refreshing every time you open the worksheet on the same computer.

In excel, which function is similar to INDIRECT?

I have a large number of excel files that I need to use for getting data.
I am looking for a function similar to INDIRECT, in order not to be necessary to have the files open to get the values. Can you help?
Thank you
Consider using ADO..............here is a reference:
Microsoft ADO Reference
In your VBA, you need to first open the workbook:
Workbooks.Open()
Then you can use Workbooks("xxx").Worksheets("").Cells() or Range() [depending on what you want to do].
When you are done taking out the info/data, then you close that worksheet.
You don't really need =INDIRECT() or ADO or even VBA. Just reference the closed worksheet like this in a cell: ='S:\Temp\[T.xls]Sheet1'!$C$4
It will update the values upon opening the workbook; you don't need to have the source workbook open at all. Or you can update them manually by choosing Edit Links from the Data tab in Excel.

Excel VBA macro not found by worksheet, #NAME

I'm trying to get a simple VBA function to run in an excel (.xlsm) worksheet.
I created this function:
Function abc()
abc = 2
End Function
in Module2, and it worked.
But after I copied the spreadsheet to another system, it now just shows "#name" as if it can't find it. The function shows up on the available list of functions however.
This makes me think there is some kind of setting I need to enable, but I've enabled whatever I was prompted for. Any ideas?
I should've known it was in the trust center:
http://office.microsoft.com/en-us/excel-help/change-macro-security-settings-in-excel-HP010096919.aspx
Basically, hit the ball and poke around until you find "trust" and "enable macros" and select the least secure options.
And then close and re-open the spreadsheet.
I think we may need more information. What version of Excel are you using? Is it different from the destination system version?
You'll want to make sure that Module2 was in the Workbook you copied into the other system. Excel 2007 stores macros on a personal workbook by default sometimes so you'll need to check the the code is actually inside of the .xlsm file.
If you're still stuck and need a quick fix just copy the code text into the new system's Excel workbook directly without making a .xlsm file (create new module in the other system then paste).
If you would like to learn how to put together add-ins you can get started here or here.

Resources