Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default help with ActiveSheet.QueryTables.Add Connection:

I'm just trying to import a txt file (little by little i'm improving...)
Below there is the first part of the code that do the input of a specific
file
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and
Settings\Roby\Documenti\Universitą\tesi\Modelli2\E dificio
esistente\Base\3PO_altezze_Y_prototipo2_OUTDATI.tx t" _
, Destination:=Range("A1"))
.Name = "3PO_altezze_Y_prototipo2_OUTDATI5"
FieldNames = True
.RowNumbers = False
............................. .
.............................



Now, I wish I can use a dialog form instead of specifying the path directly
in the code as above written

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and
Settings\Roby\Documenti\Universitą\tesi\Modelli2\E dificio
esistente\Base\3PO_altezze_Y_prototipo2_OUTDATI.tx t" _
, Destination:=Range("A1"))

I think may it is possible to use somthing as Application.GetOpenFilename to
indicate the connection path...In other terms, as I have to do import
procedure for a lot of *.txt files, I don't want to have to specify
explicitally the path for every file...It will be better to be able to use a
graphic interface that allow me to browse for the file....

Thanks in advance for every help...!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default help with ActiveSheet.QueryTables.Add Connection:

If you want to use GetOpenfilename to specify the file:

Dim fName as Variant
fname = Application.GetOpenFilename()
if fname < False then
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & fName _
, Destination:=Range("A1"))

............................................
End if
Otherwise, it is unclear what you are saying.

--
Regards,
Tom Ogilvy



"uriel78" wrote in message
...
I'm just trying to import a txt file (little by little i'm improving...)
Below there is the first part of the code that do the input of a specific
file
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and
Settings\Roby\Documenti\Universitą\tesi\Modelli2\E dificio
esistente\Base\3PO_altezze_Y_prototipo2_OUTDATI.tx t" _
, Destination:=Range("A1"))
.Name = "3PO_altezze_Y_prototipo2_OUTDATI5"
FieldNames = True
.RowNumbers = False
............................ .
............................



Now, I wish I can use a dialog form instead of specifying the path

directly
in the code as above written

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and
Settings\Roby\Documenti\Universitą\tesi\Modelli2\E dificio
esistente\Base\3PO_altezze_Y_prototipo2_OUTDATI.tx t" _
, Destination:=Range("A1"))

I think may it is possible to use somthing as Application.GetOpenFilename

to
indicate the connection path...In other terms, as I have to do import
procedure for a lot of *.txt files, I don't want to have to specify
explicitally the path for every file...It will be better to be able to use

a
graphic interface that allow me to browse for the file....

Thanks in advance for every help...!




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
always recheck data connection library for latest connection strin FurmanGG Excel Discussion (Misc queries) 0 September 14th 07 04:48 PM
QueryTables Add Marta[_3_] Excel Programming 0 January 19th 05 05:32 PM
ActiveSheet.QueryTables.Add using a File DSN Brian Howenstein Excel Programming 1 April 6th 04 11:45 AM
With ActiveSheet.QueryTables.Add [email protected] Excel Programming 4 January 6th 04 04:58 PM


All times are GMT +1. The time now is 09:36 AM.

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"