Macros - Importing text file within a specific worksheet

  • Thread starter Thread starter EH Chew
  • Start date Start date
E

EH Chew

Hi

I hope someone can assist me here. I am trying to write a
macro which would allow me to import a text file within
the active sheet (say for eg. Data Summary - is the
worksheet name).

I have a similar script/macro command in Lotus 123 but I
am not sure how to convert it in MS Excel (Excel 2002).
The command is:
[DATA SUMMARY:A1].RangeCombineText doc1,currpath,$Text

Note: (this is the other part of the script/macro in
Lotus 123)
Dim currdoc As document
Dim doc1 As String
Dim currpath As String
Dim mmyyyy As String
Set currdoc = CurrentDocument
currpath = currdoc.Path
mmyyyy = "012004"
doc1="84-104-0210."+mmyyyy+".SUMMARY"

Hope someone can help me out here. Really appreciate the
help. Thanks in advance.

Best regards
EH Chew
 
EH,

You don't say which version of Excel you are using. In XP, you can use
Data - Get External Data, which will read the text file into a cell of your
choice. The text import wizard prompts you for specifics. Not only that,
but you can use Refresh to read it again. It remembers. I don't think this
exists in Excel 2000.
 
Dear Earl

Hi. The version of Excel is 2002 (or MS Excel 2002
[10.4524.4219] SP2). What is the exact macro to do it?
Also could you provide an example? Thanks

EH
-----Original Message-----
EH,

You don't say which version of Excel you are using. In XP, you can use
Data - Get External Data, which will read the text file into a cell of your
choice. The text import wizard prompts you for specifics. Not only that,
but you can use Refresh to read it again. It remembers. I don't think this
exists in Excel 2000.

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

EH Chew said:
Hi

I hope someone can assist me here. I am trying to write a
macro which would allow me to import a text file within
the active sheet (say for eg. Data Summary - is the
worksheet name).

I have a similar script/macro command in Lotus 123 but I
am not sure how to convert it in MS Excel (Excel 2002).
The command is:
[DATA SUMMARY:A1].RangeCombineText doc1,currpath,$Text

Note: (this is the other part of the script/macro in
Lotus 123)
Dim currdoc As document
Dim doc1 As String
Dim currpath As String
Dim mmyyyy As String
Set currdoc = CurrentDocument
currpath = currdoc.Path
mmyyyy = "012004"
doc1="84-104-0210."+mmyyyy+".SUMMARY"

Hope someone can help me out here. Really appreciate the
help. Thanks in advance.

Best regards
EH Chew


.
 
The easiest way is to record a macro as you import the data.

Use Data menu > Get External Data > Create New Query

Select Text Locate your text file
Select fields to be included

continue following the prompts

If this does not give you what you are after then it would be best t
open the file as a text file using normal File > Open commands the
copy the data over to your workboo
 
Chew,

You don't need a macro in 2002. XP is 2002. Check out my earlier reply.
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

Dear Earl

Hi. The version of Excel is 2002 (or MS Excel 2002
[10.4524.4219] SP2). What is the exact macro to do it?
Also could you provide an example? Thanks

EH
-----Original Message-----
EH,

You don't say which version of Excel you are using. In XP, you can use
Data - Get External Data, which will read the text file into a cell of your
choice. The text import wizard prompts you for specifics. Not only that,
but you can use Refresh to read it again. It remembers. I don't think this
exists in Excel 2000.

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

EH Chew said:
Hi

I hope someone can assist me here. I am trying to write a
macro which would allow me to import a text file within
the active sheet (say for eg. Data Summary - is the
worksheet name).

I have a similar script/macro command in Lotus 123 but I
am not sure how to convert it in MS Excel (Excel 2002).
The command is:
[DATA SUMMARY:A1].RangeCombineText doc1,currpath,$Text

Note: (this is the other part of the script/macro in
Lotus 123)
Dim currdoc As document
Dim doc1 As String
Dim currpath As String
Dim mmyyyy As String
Set currdoc = CurrentDocument
currpath = currdoc.Path
mmyyyy = "012004"
doc1="84-104-0210."+mmyyyy+".SUMMARY"

Hope someone can help me out here. Really appreciate the
help. Thanks in advance.

Best regards
EH Chew


.
 
Back
Top