Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to copy daily text file

I have a different text file (same format) to be copied into a spreadsheet daily.
Eg Day 1 text file to be copied into sheet D1, Day 2 text file to be copied into sheet D2. What is the fastest way?
I tried using macro copy (with relative reference) - text file in same sheet overriding on daily basis. It does not work.Appreciate all help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to copy daily text file

Try this for starters

Note This does not test to see if sheet name already exists
You will also need to modify the
Workbooks.OpenText
statement to suit your needs


Dim wsNew As Worksheets
Set wsNew = Sheets.Add
wsNew.Name = "D" & Day(Now())

Workbooks.OpenText FileName:="D:\My Documents\Book2.txt", _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, _
Space:=False, Other:=False, FieldInfo:=Array(1, 1)

ActiveWorkbook.Sheets(1).Cells.Copy Destination:=wsNew.Cells
ActiveWorkbook.Close savechanges:=Fals

--
Message posted from http://www.ExcelForum.com

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
Macro to save and close, then copy file NewSysAdmin Excel Discussion (Misc queries) 2 December 2nd 09 03:24 PM
copy cells daily and automatically RJJ Excel Worksheet Functions 3 May 10th 09 01:01 PM
Copy file with a macro Brettjg Excel Discussion (Misc queries) 2 March 2nd 07 01:46 AM
Using Macro to Save Copy of File to New Location Chris Z Excel Discussion (Misc queries) 3 September 12th 06 11:26 PM
File Copy Macro Nigel Bishop Excel Programming 2 January 22nd 04 06:36 PM


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