When using formatted text strings to reference other items within an MSI install table be aware of case. A reference to [#filename.txt] is not the same as [#Filename.txt]
http://msdn.microsoft.com/en-us/library/aa368609(v=VS.85).aspx
This page refers to the correct method to write an environmental variable into a registry key.
e.g. [%environmentvariable]