Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I read text file in an EXCEL SHEET

Hello,

With regards to EXCEL how we read the text file in EXCEL sheet using
MACRO.
The file is located in d:\Sql\Documents\Amit\log.txt.
I want to save the EXCEL sheet, and every time when I open this sheet
it reads this text file and displays the contents of this text file in
Excel Sheet.
I want to use MACRO for reading this text file.How I do that?

Thanks

Amit
  #2   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I read text file in an EXCEL SHEET

fileName = "D:\Sql\Documents\Amit\log.txt"

Workbooks.OpenText FileName:=fileName

OR

Workbooks.OpenText FileName:=fileName, Origin:=xlWindows, StartRow _
:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(0, 2), Array(10, 2). . .)


Alex


"AMIT" wrote in message
om...
Hello,

With regards to EXCEL how we read the text file in EXCEL sheet using
MACRO.
The file is located in d:\Sql\Documents\Amit\log.txt.
I want to save the EXCEL sheet, and every time when I open this sheet
it reads this text file and displays the contents of this text file in
Excel Sheet.
I want to use MACRO for reading this text file.How I do that?

Thanks

Amit



  #3   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I read and refreshes the information in the text file in an EXCEL SHEET,every time when I run macro

Hello,

Thanks for your information.
But I still need some more info about the problem.
Actually I want that every time when I run the macro, it refreshes the
information from the text file, from the following path
(d:\Sql\Documents\Amit\log.txt) and display its contents on the Excel
sheet. How should I record the macro in order to perform this
operation?


Best Regards

Amit.








"biju" wrote in message ...
Dear Amit

Pls. enable the macro record option from tools menu after opening excel and use the manual way of opening the text file
by listing only text files and selecting it..stop/close recording the macro after assigning a shortcut(keys) and thats it..

with regards
biju

Eg :
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 12/30/2003 by biju
'
' Keyboard Shortcut: Ctrl+l
'
ChDir "d:\Sql\Documents\Amit\"
Workbooks.OpenText Filename:="d:\Sql\Documents\Amit\log.txt", Origin:=xlWindows, StartRow _
:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), _
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), _
Array(10, 1), Array(11, 1))
End Sub

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
Split text file into Excel sheet and separate the final results intoa new sheet Luciano Paulino da Silva Excel Worksheet Functions 8 April 18th 09 02:00 AM
How do you save an excel file to be read as IBM-type text file ? Dee Franklin Excel Worksheet Functions 2 October 10th 06 02:46 AM
Neet to use Excel to read in multiple-sheet file VMetze Excel Worksheet Functions 2 June 29th 06 08:14 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM
Read text file jacob[_3_] Excel Programming 2 September 23rd 03 06:41 PM


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

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

About Us

"It's about Microsoft Excel"