So since this seems impossible, I thought of maybe an easier workaround.
My formula in the excel now looks like this
=VLOOKUP(INDEX(DATABASE!D:D;MATCH("*"&LEFT(A2;1000)&"*";DATABASE!G:G;0));PRICELIST!B:C;2;FALSE)
Which basically when I scan with my barcode reader in cell A2, in cell C2 it returns the price for a book. The problem is that I have to alt+tab and copy paste all the time since the price needs to be pasted in a non-excel application, which makes it a little bit slow.
What I would like to do is make this a little bit more automatic by usign AutoHotkey so when I press a combination of keys in my keyboard this would initiate a copy to clipboard and execute. So what i want to do is have a stand-alone vbs file that would perfom the above formula even if the excel is closed and would replace (substitute) the clipboard (i.e. the barcode scanned) with the price (i.e. the result of the above function)