Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Importing Text File


Hi Guys,

has anyone got a macro where I can import a text file saved on my
computer into a new sheet named yesterdays or todays date in format
"ddmmyy" and then the sheet gets hidden.

Thanks in advance for your help

Gunny


--
gunny1979


------------------------------------------------------------------------
gunny1979's Profile: http://www.excelforum.com/member.php...o&userid=32932
View this thread: http://www.excelforum.com/showthread...hreadid=545015

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Importing Text File


Sub ImportData()
ThisWorkbook.Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = Format(Date, "ddmmyy")
Workbooks.Open FileName:="C:\text.txt", Format:=2
Cells.Copy ThisWorkbook.Sheets(Format(Date, "ddmmyy")).[a1]
Workbooks("text.txt").Close savechganges:=False
Sheets(Format(Date, "ddmmyy")).Visible = False
End Sub

Change "C:\text.txt" to refer to your file. I've assumed that the file
is comma-delimited. If it's not, change the "Format:=2" to whatever you
need it to be (check Help for the Open method for the options).

Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=545015

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Importing Text File

Hi Gunny,

use macro recorder. In case you will need to modify the recorded code,
post it in the forum.

Regards,
Ivan

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
Importing a text file Helena MouriƱo Excel Discussion (Misc queries) 1 April 2nd 09 07:20 PM
Importing CSV file (saved as Text) into XL as Text -- over 60 colu sbp Excel Discussion (Misc queries) 1 October 14th 06 11:50 PM
Importing text file, only option to edit existing file smokey99 Excel Discussion (Misc queries) 8 April 26th 06 09:08 PM
importing text file, removing data and outputting new text file Pal Excel Programming 8 February 27th 04 08:32 PM
Importing Text File Daniel Brow Excel Programming 1 February 9th 04 01:20 AM


All times are GMT +1. The time now is 04: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"