R
R. Choate
I'm at wits end. I've tried to be a little lazy and I've used the macro recorder to write some code for me to import external data
from a tab-delimited text file. My first problem is that I just want to import the data. I don't want to save the query and I go
into the properties when I'm doing the import and I uncheck that box. However, after it imports the query, when I later delete the
data, it tells me there is a query saved with that data and I'll be deleting it if I check "Yes". This is about to make me scream.
Please tell me how I can import the data without this problem.
Secondly, still on the issue of the macro recorder writing code. I am importing data from 4 sources onto 4 worksheets independently
of each other. Two of the imports are from other Excel files. The code it creates for those imports is REALLY driving me up the
wall. Below is the 1st couple of lines of code:
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Documents and
Settings\Administrator\Desktop\KoreAug.x" _
, _
"ls;Mode=Share Deny Write;Extended Properties=""HDR=YES;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet
OLEDB
ataba" _
Notice that it cuts off the file extension, xls, right at the "x"! I don't get it. Making matters worse, it then puts ", _" on the
next line, and begins the next line with "ls;".
If I try to fix this stupid code and eliminate the comma and the split, and just put the whole name on the same line, I either get
errors when I run it the code (type mismatch?) or the whole code turns red on me for syntax problems. Does anybody have any idea
what in the wild world of sports is going on here? Finally, is there some boilerplate code I could use for just importing some basic
data from a table in an external xls file without all of this BS?
Thank you very much in advance !
from a tab-delimited text file. My first problem is that I just want to import the data. I don't want to save the query and I go
into the properties when I'm doing the import and I uncheck that box. However, after it imports the query, when I later delete the
data, it tells me there is a query saved with that data and I'll be deleting it if I check "Yes". This is about to make me scream.
Please tell me how I can import the data without this problem.
Secondly, still on the issue of the macro recorder writing code. I am importing data from 4 sources onto 4 worksheets independently
of each other. Two of the imports are from other Excel files. The code it creates for those imports is REALLY driving me up the
wall. Below is the 1st couple of lines of code:
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Documents and
Settings\Administrator\Desktop\KoreAug.x" _
, _
"ls;Mode=Share Deny Write;Extended Properties=""HDR=YES;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet
OLEDB
Notice that it cuts off the file extension, xls, right at the "x"! I don't get it. Making matters worse, it then puts ", _" on the
next line, and begins the next line with "ls;".
If I try to fix this stupid code and eliminate the comma and the split, and just put the whole name on the same line, I either get
errors when I run it the code (type mismatch?) or the whole code turns red on me for syntax problems. Does anybody have any idea
what in the wild world of sports is going on here? Finally, is there some boilerplate code I could use for just importing some basic
data from a table in an external xls file without all of this BS?
Thank you very much in advance !