Hi All,

I am trying to write some VBA to import a comma delimited text file into Excel on a 'one import operation = 1 row in excel' basis.

So a) use definied shortcut to browse system
b) select text file
c) row i am in in excel is populated by data
d) some other code which i have written changes some of the data according to a series of activecell and if statements.

The code that excel generated for me when i recorded a new macro is shown below. It all works fine and smoothly BUT I am being bugged by messages about external data each time i open the file, and the original data source styill seems to have some profound grip on the data indefinately. The result is some unpredictable behaviour at certain times when importing and continually being asked if i want to 'automatically refresh query' all the time. If i do refresh then to data reverts to the raw form that it was imported in before ebing edited by my routines.

If I manually go into an imported record, right click and choose 'data range properties' and unckeck 'save query definition' the data is released and i can continue unhasstled.

Does anybody know how to deactivate the link between the data/query in macro code so that impoted data is no longer linked to the original file in any way.

If anybody can have a go at this it would be appreciated.

Thanks in advance for any help,

Don

The code is :

Please Login or Register  to view this content.