#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Import Data


I am trying to import data through "Get External Data"
using a macro that changes the file name according to the
month and year.

Using the following code it always shows and error
on .Refresh BackgroundQuery:=False and I have tried True
but neither work.


sName = (Left(Range("B1"), 4))
sDate = "" & Format(DateSerial(Year(Date), Month
(Date) - 1, 1), " mmm yy ")

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\My
Documents\sName & sDate & INFO\DATA INPUT." _
, Destination:=Range("A1"))
.Name = "SALES."
'details
.Refresh BackgroundQuery:=False
End With
End Sub

Cell B1 = Johnson & Paul
Date = 8/31/2004

So the file name would be "John Aug 04 Info"

Path and file should be - C:\Documents and Settings\My
Documents\John Aug 04 Info

Any ideas as to what I am doing wrong??

Thanks for any help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Import Data


-----Original Message-----

I am trying to import data through "Get External Data"
using a macro that changes the file name according to

the
month and year.

Using the following code it always shows and error
on .Refresh BackgroundQuery:=False and I have tried True
but neither work.


sName = (Left(Range("B1"), 4))
sDate = "" & Format(DateSerial(Year(Date), Month
(Date) - 1, 1), " mmm yy ")

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\My
Documents\sName & sDate & INFO\DATA INPUT." _
, Destination:=Range("A1"))
.Name = "SALES."
'details
.Refresh BackgroundQuery:=False
End With
End Sub

Cell B1 = Johnson & Paul
Date = 8/31/2004

So the file name would be "John Aug 04 Info"

Path and file should be - C:\Documents and Settings\My
Documents\John Aug 04 Info

Any ideas as to what I am doing wrong??

Thanks for any help.

.
See "Path and File Name" question for a simplier question

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
import XML data...Is there a size limit on the import? MatthewG Excel Discussion (Misc queries) 0 February 10th 09 05:57 PM
How to Start Excel in Text Import Wizard for data import rlelvis Setting up and Configuration of Excel 0 July 10th 08 08:40 PM
Import external data, data includes Excel function allen davidson Excel Worksheet Functions 0 July 4th 08 12:39 PM
Prevent equation from skipping data when referencing import data? lybrt98 Excel Discussion (Misc queries) 0 August 30th 05 05:01 PM
how to Import data in excel office2003 with data more 65000 rows Abhijit Excel Worksheet Functions 1 May 13th 05 05:12 AM


All times are GMT +1. The time now is 12:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"