>If I enter this line of code in my application it works:
>
>import from "C:\Data\dBases\Beyond Gold\Test.xls" database BG name Incoming type xl8 as 1252
>
>If I save "C:\Data\dBases\Beyond Gold\Test.xls" to a variable m.Test and then use that thusly:
>
>import from m.Test database BG name Incoming type xl8 as 1252
>or
>import from &m.Test database BG name Incoming type xl8 as 1252
>or
>import from eval(m.Test) database BG name Incoming type xl8 as 1252
>
>all fail with file not found.
>
>Is there any way of using Import From with a variable file name?
>
Try:
import from (m.test) database BG name Incoming type xl8 as 1252
this is using name resolution rather than expression evaluation or macro expansion, and is the best option where a VFP command expects a name but you've stuck the name in a field, variable or property, or is a return from a function or method call. For example:
import from (GETFILE('XLS|XL8','Gimme a spreadsheet to read','Read')) database BG name Incoming type xl8 as 1252
works just fine as long as you get a file name back...
>TIA
>
>DJ