LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Saving Text Delimited to Excel - T. Oglivy

In the below, I am copying the first number of rows from
one file and pasting it into another file that shares a
very similar name. It works great with two exceptions:

1. Because it is Tab Delimited, when my code goes to Save
the destination file, it gets a prompt to "save as", so I
must manually switch "Save as Type" to Excel, click save,
and then it prompts me that the file already exists, and I
must click "OK" to over-write... I'm looking to automate
this piece....


2. In my SrcList = Array, I have all the names of the
source files I would like included in a separate
spreadsheet, which I tried to paste in, but it doesn't
like it. Any suggestions on how to quickly add file names
in this manner?


Thanks in advance for any help!





Sub RAW_AA()

Dim PathSrc As String, PathDest As String
Dim srcList As Variant
Dim i As Long, sDest As String
Dim bkSrc As Workbook, bkDest As Workbook

PathSrc = "Y:\Sales\Target Customer\2005 Raw\"
PathDest = "Y:\Sales\Target Customer\2005 Raw - Main\"

srcList = Array("Raw 1.xls", _
"Raw 2.xls", _
"Raw 3.xls", _
"CO1TR002-02.xls", _
"CO1TR019-02.xls", _
"CO1TR028-09.xls", _
"CO2TR017-02.xls")

For i = LBound(srcList) To UBound(srcList)
Set bkSrc = Workbooks.Open(PathSrc & srcList(i))
sDest = bkSrc.Name
sDest = Left(sDest, Len(sDest) - 4) & "M.xls"
Set bkDest = Workbooks.Open(PathDest & sDest)
bkSrc.Worksheets(1).Rows(1).Resize(50).Copy _
Destination:=bkDest.Worksheets(1).Range("A1")
bkSrc.Close SaveChanges:=False
bkDest.Close SaveChanges:=True
Next

End Sub
 
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
Saving as text(tab delimited) file Pam New Users to Excel 1 November 4th 09 01:30 AM
Copying data to new workbook and saving as text delimited Bob1866 Excel Discussion (Misc queries) 1 September 5th 09 04:05 AM
saving file as text(tab delimited)... Sevgi Excel Discussion (Misc queries) 1 April 6th 05 07:04 PM
Saving spreadsheets as delimited text files rwebster3[_2_] Excel Programming 2 April 22nd 04 01:46 AM
saving excel file as tab delimited text programmatically Philip[_4_] Excel Programming 0 October 23rd 03 10:12 AM


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