Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
I'm attempting to program a new function that includes other functions
provided by Bloomberg professional service. The end result needs to look like this: BDP("AUD Curncy","LAST_PRICE") The AUD Curncy is Bloomberg's security code, which I will be getting from two separate cells. I am able to put the two cells together as follows: BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & BBKEY My problem is that I need to get quotation marks around the FULLBBCODE in the VBA code. When I've tried """ & FULLBBCODE &""" it just returns that exact text, not what FULLBBCODE represents. Hope I've explained this enough, any help would be greatly appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
One more each time
"""" & FULLBBCODE & """" -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Matt" wrote in message ... I'm attempting to program a new function that includes other functions provided by Bloomberg professional service. The end result needs to look like this: BDP("AUD Curncy","LAST_PRICE") The AUD Curncy is Bloomberg's security code, which I will be getting from two separate cells. I am able to put the two cells together as follows: BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & BBKEY My problem is that I need to get quotation marks around the FULLBBCODE in the VBA code. When I've tried """ & FULLBBCODE &""" it just returns that exact text, not what FULLBBCODE represents. Hope I've explained this enough, any help would be greatly appreciated. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Tried it, didn't work the way I was hoping. It does return AUD Curncy in a
cell, but I think I didn't provide enough information about the problem. So in my code, I want to execute the Bloomberg function which works fine if I manually put in Function = [BDP("AUD Curncy","LAST_PRICE")] but does not work when I substitute the variable below, that's when I have problems. Any ideas? "Bob Phillips" wrote: One more each time """" & FULLBBCODE & """" -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Matt" wrote in message ... I'm attempting to program a new function that includes other functions provided by Bloomberg professional service. The end result needs to look like this: BDP("AUD Curncy","LAST_PRICE") The AUD Curncy is Bloomberg's security code, which I will be getting from two separate cells. I am able to put the two cells together as follows: BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & BBKEY My problem is that I need to get quotation marks around the FULLBBCODE in the VBA code. When I've tried """ & FULLBBCODE &""" it just returns that exact text, not what FULLBBCODE represents. Hope I've explained this enough, any help would be greatly appreciated. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
How about chr(34) & FULLBBCODE & chr(34)
Does that work? "Matt" wrote in message ... Tried it, didn't work the way I was hoping. It does return AUD Curncy in a cell, but I think I didn't provide enough information about the problem. So in my code, I want to execute the Bloomberg function which works fine if I manually put in Function = [BDP("AUD Curncy","LAST_PRICE")] but does not work when I substitute the variable below, that's when I have problems. Any ideas? "Bob Phillips" wrote: One more each time """" & FULLBBCODE & """" -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Matt" wrote in message ... I'm attempting to program a new function that includes other functions provided by Bloomberg professional service. The end result needs to look like this: BDP("AUD Curncy","LAST_PRICE") The AUD Curncy is Bloomberg's security code, which I will be getting from two separate cells. I am able to put the two cells together as follows: BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & BBKEY My problem is that I need to get quotation marks around the FULLBBCODE in the VBA code. When I've tried """ & FULLBBCODE &""" it just returns that exact text, not what FULLBBCODE represents. Hope I've explained this enough, any help would be greatly appreciated. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Doesn't seem to work. I have figured out that I can put a cell reference in,
like B2 & " " & B3, where B2 = AUD and B3 = Curncy, and this works. However I really didn't want to have to hardcode references in, I want the user to be able to change where this data is contained in the future if possible. Although for the sake of time I may just go that route. Any other ideas? "Zone" wrote: How about chr(34) & FULLBBCODE & chr(34) Does that work? "Matt" wrote in message ... Tried it, didn't work the way I was hoping. It does return AUD Curncy in a cell, but I think I didn't provide enough information about the problem. So in my code, I want to execute the Bloomberg function which works fine if I manually put in Function = [BDP("AUD Curncy","LAST_PRICE")] but does not work when I substitute the variable below, that's when I have problems. Any ideas? "Bob Phillips" wrote: One more each time """" & FULLBBCODE & """" -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Matt" wrote in message ... I'm attempting to program a new function that includes other functions provided by Bloomberg professional service. The end result needs to look like this: BDP("AUD Curncy","LAST_PRICE") The AUD Curncy is Bloomberg's security code, which I will be getting from two separate cells. I am able to put the two cells together as follows: BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & BBKEY My problem is that I need to get quotation marks around the FULLBBCODE in the VBA code. When I've tried """ & FULLBBCODE &""" it just returns that exact text, not what FULLBBCODE represents. Hope I've explained this enough, any help would be greatly appreciated. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Matt, can you just post your entire routine? I think we're missing
something. James "Matt McMaster" wrote in message ... Doesn't seem to work. I have figured out that I can put a cell reference in, like B2 & " " & B3, where B2 = AUD and B3 = Curncy, and this works. However I really didn't want to have to hardcode references in, I want the user to be able to change where this data is contained in the future if possible. Although for the sake of time I may just go that route. Any other ideas? "Zone" wrote: How about chr(34) & FULLBBCODE & chr(34) Does that work? "Matt" wrote in message ... Tried it, didn't work the way I was hoping. It does return AUD Curncy in a cell, but I think I didn't provide enough information about the problem. So in my code, I want to execute the Bloomberg function which works fine if I manually put in Function = [BDP("AUD Curncy","LAST_PRICE")] but does not work when I substitute the variable below, that's when I have problems. Any ideas? "Bob Phillips" wrote: One more each time """" & FULLBBCODE & """" -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Matt" wrote in message ... I'm attempting to program a new function that includes other functions provided by Bloomberg professional service. The end result needs to look like this: BDP("AUD Curncy","LAST_PRICE") The AUD Curncy is Bloomberg's security code, which I will be getting from two separate cells. I am able to put the two cells together as follows: BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & BBKEY My problem is that I need to get quotation marks around the FULLBBCODE in the VBA code. When I've tried """ & FULLBBCODE &""" it just returns that exact text, not what FULLBBCODE represents. Hope I've explained this enough, any help would be greatly appreciated. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
It might be a typo on your part, but let's go back to what you posted
originally... BDP("AUD Curncy","LAST_PRICE") BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & BBKEY FULLBBCODE, as constructed, will not have the blank space between BBCODE and BBKEY. Try the assignment this way... FULLBBCODE = BBCODE & " " & BBKEY and see if that helps any. I'm thinking your code should look something like this... BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & " " & BBKEY <<Function = "BDP(""" & FULLBBCODE & """,""LAST_PRICE"")" You used "Function" as a variable in your original posting... that is a reserved keyword and cannot be the name of a variable. Rick "Matt McMaster" wrote in message ... Doesn't seem to work. I have figured out that I can put a cell reference in, like B2 & " " & B3, where B2 = AUD and B3 = Curncy, and this works. However I really didn't want to have to hardcode references in, I want the user to be able to change where this data is contained in the future if possible. Although for the sake of time I may just go that route. Any other ideas? "Zone" wrote: How about chr(34) & FULLBBCODE & chr(34) Does that work? "Matt" wrote in message ... Tried it, didn't work the way I was hoping. It does return AUD Curncy in a cell, but I think I didn't provide enough information about the problem. So in my code, I want to execute the Bloomberg function which works fine if I manually put in Function = [BDP("AUD Curncy","LAST_PRICE")] but does not work when I substitute the variable below, that's when I have problems. Any ideas? "Bob Phillips" wrote: One more each time """" & FULLBBCODE & """" -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Matt" wrote in message ... I'm attempting to program a new function that includes other functions provided by Bloomberg professional service. The end result needs to look like this: BDP("AUD Curncy","LAST_PRICE") The AUD Curncy is Bloomberg's security code, which I will be getting from two separate cells. I am able to put the two cells together as follows: BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & BBKEY My problem is that I need to get quotation marks around the FULLBBCODE in the VBA code. When I've tried """ & FULLBBCODE &""" it just returns that exact text, not what FULLBBCODE represents. Hope I've explained this enough, any help would be greatly appreciated. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Sure,
Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = [BDP(FULLBBCODE, "Last Price")] End Function where BBCODE equals cell B2 = AUD and BBKEY equals cell B3 = Curncy BDP is the Bloomberg function that I'm using to return real-time market data. So I've tried the suggestions from earlier and none seem to make the function work. I can manually type in "AUD Curncy" in the function and it works, I can put B2 & " " & B3 manually and get it to work, and I've tried using the index function and that works. But of course what I really want is something close to what I've typed above, very frustrating. Any help is appreciated, thanks. "Zone" wrote: Matt, can you just post your entire routine? I think we're missing something. James "Matt McMaster" wrote in message ... Doesn't seem to work. I have figured out that I can put a cell reference in, like B2 & " " & B3, where B2 = AUD and B3 = Curncy, and this works. However I really didn't want to have to hardcode references in, I want the user to be able to change where this data is contained in the future if possible. Although for the sake of time I may just go that route. Any other ideas? "Zone" wrote: How about chr(34) & FULLBBCODE & chr(34) Does that work? "Matt" wrote in message ... Tried it, didn't work the way I was hoping. It does return AUD Curncy in a cell, but I think I didn't provide enough information about the problem. So in my code, I want to execute the Bloomberg function which works fine if I manually put in Function = [BDP("AUD Curncy","LAST_PRICE")] but does not work when I substitute the variable below, that's when I have problems. Any ideas? "Bob Phillips" wrote: One more each time """" & FULLBBCODE & """" -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Matt" wrote in message ... I'm attempting to program a new function that includes other functions provided by Bloomberg professional service. The end result needs to look like this: BDP("AUD Curncy","LAST_PRICE") The AUD Curncy is Bloomberg's security code, which I will be getting from two separate cells. I am able to put the two cells together as follows: BBCODE = AUD BBKEY = Curncy FULLBBCODE = BBCODE & BBKEY My problem is that I need to get quotation marks around the FULLBBCODE in the VBA code. When I've tried """ & FULLBBCODE &""" it just returns that exact text, not what FULLBBCODE represents. Hope I've explained this enough, any help would be greatly appreciated. |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Function Futures (BBCODE, BBKEY)
FULLBBCODE = BBCODE & " " & BBKEY Futures = [BDP(FULLBBCODE, "Last Price")] End Function where BBCODE equals cell B2 = AUD and BBKEY equals cell B3 = Curncy What about this? Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = ["BDP(""" & FULLBBCODE & """,""LAST_PRICE"")"] End Function Rick |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Sorry, still returns an error.
As an alternative, is there anyway to use the reference supplied by the user. So instead of getting the value AUD, I get B2 and then I could use that? Matt "Rick Rothstein (MVP - VB)" wrote: Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = [BDP(FULLBBCODE, "Last Price")] End Function where BBCODE equals cell B2 = AUD and BBKEY equals cell B3 = Curncy What about this? Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = ["BDP(""" & FULLBBCODE & """,""LAST_PRICE"")"] End Function Rick |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Tell us what the error is.
Rick "Matt McMaster" wrote in message ... Sorry, still returns an error. As an alternative, is there anyway to use the reference supplied by the user. So instead of getting the value AUD, I get B2 and then I could use that? Matt "Rick Rothstein (MVP - VB)" wrote: Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = [BDP(FULLBBCODE, "Last Price")] End Function where BBCODE equals cell B2 = AUD and BBKEY equals cell B3 = Curncy What about this? Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = ["BDP(""" & FULLBBCODE & """,""LAST_PRICE"")"] End Function Rick |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
It's returning a #NAME? error, which basically means the Bloomberg function
didn't understand what I was giving it. "Rick Rothstein (MVP - VB)" wrote: Tell us what the error is. Rick "Matt McMaster" wrote in message ... Sorry, still returns an error. As an alternative, is there anyway to use the reference supplied by the user. So instead of getting the value AUD, I get B2 and then I could use that? Matt "Rick Rothstein (MVP - VB)" wrote: Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = [BDP(FULLBBCODE, "Last Price")] End Function where BBCODE equals cell B2 = AUD and BBKEY equals cell B3 = Curncy What about this? Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = ["BDP(""" & FULLBBCODE & """,""LAST_PRICE"")"] End Function Rick |
#13
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Matt, I think it's a case of "you can't get there from here, you'll have to
go somewhere else and start from there!", meaning you'll have to build the entire formula in a different way (maybe using a userform?) and insert the entire formula in the cell, to get it to work properly. Seems to me if the outer function (BDP) is looking for literal string arguments, it's not going to be happy with UDF-created arguments unless the entire formula is created elsewhere and inserted in the cell. Of course, I could be wrong. Maybe Rick has more ideas. James "Matt McMaster" wrote in message ... Sorry, still returns an error. As an alternative, is there anyway to use the reference supplied by the user. So instead of getting the value AUD, I get B2 and then I could use that? Matt "Rick Rothstein (MVP - VB)" wrote: Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = [BDP(FULLBBCODE, "Last Price")] End Function where BBCODE equals cell B2 = AUD and BBKEY equals cell B3 = Curncy What about this? Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = ["BDP(""" & FULLBBCODE & """,""LAST_PRICE"")"] End Function Rick |
#14
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Thanks James and Rick for the help. Just to follow up, Bloomberg does have
an RTD program that is a little more forgiving in what it will accept as arguments so I'm going to use that for now and forego on using the Bloomberg function. Thanks again for the help. BTW, if there is a way to extract the address of a cell from what is specified in the function, I would still be very interested. "Zone" wrote: Matt, I think it's a case of "you can't get there from here, you'll have to go somewhere else and start from there!", meaning you'll have to build the entire formula in a different way (maybe using a userform?) and insert the entire formula in the cell, to get it to work properly. Seems to me if the outer function (BDP) is looking for literal string arguments, it's not going to be happy with UDF-created arguments unless the entire formula is created elsewhere and inserted in the cell. Of course, I could be wrong. Maybe Rick has more ideas. James "Matt McMaster" wrote in message ... Sorry, still returns an error. As an alternative, is there anyway to use the reference supplied by the user. So instead of getting the value AUD, I get B2 and then I could use that? Matt "Rick Rothstein (MVP - VB)" wrote: Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = [BDP(FULLBBCODE, "Last Price")] End Function where BBCODE equals cell B2 = AUD and BBKEY equals cell B3 = Curncy What about this? Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = ["BDP(""" & FULLBBCODE & """,""LAST_PRICE"")"] End Function Rick |
#15
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming Function
Use the RTD wrapper.
The other BBG functions won't let you do what you want. RTD is very flexible. Find someone at the desktop build group at Bloomberg (most of the firstline responders won't have a clue), if that doesn't solve your problem. If you type BBXL <GO, open a couple of sample files, and find the author. I've always found that they are very helpful (after an initial "it's not really our job to support your programming"). Downside of the RTD wrapper - I think it's being phased out (either by BBG or MSFT, can't remember which). HTH "Matt McMaster" wrote: Thanks James and Rick for the help. Just to follow up, Bloomberg does have an RTD program that is a little more forgiving in what it will accept as arguments so I'm going to use that for now and forego on using the Bloomberg function. Thanks again for the help. BTW, if there is a way to extract the address of a cell from what is specified in the function, I would still be very interested. "Zone" wrote: Matt, I think it's a case of "you can't get there from here, you'll have to go somewhere else and start from there!", meaning you'll have to build the entire formula in a different way (maybe using a userform?) and insert the entire formula in the cell, to get it to work properly. Seems to me if the outer function (BDP) is looking for literal string arguments, it's not going to be happy with UDF-created arguments unless the entire formula is created elsewhere and inserted in the cell. Of course, I could be wrong. Maybe Rick has more ideas. James "Matt McMaster" wrote in message ... Sorry, still returns an error. As an alternative, is there anyway to use the reference supplied by the user. So instead of getting the value AUD, I get B2 and then I could use that? Matt "Rick Rothstein (MVP - VB)" wrote: Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = [BDP(FULLBBCODE, "Last Price")] End Function where BBCODE equals cell B2 = AUD and BBKEY equals cell B3 = Curncy What about this? Function Futures (BBCODE, BBKEY) FULLBBCODE = BBCODE & " " & BBKEY Futures = ["BDP(""" & FULLBBCODE & """,""LAST_PRICE"")"] End Function Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Programming or Function? | Excel Discussion (Misc queries) | |||
WORKSHEET FUNCTION or PROGRAMMING. | Excel Worksheet Functions | |||
Programming a Function in VB | Excel Discussion (Misc queries) | |||
VBA programming-autofilter function | Excel Programming | |||
Function tool or programming...Help please! | Excel Programming |