LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default open Excel formatted differently than the default format

No, but you could create a macro that would open each of your .csv files, format
it the way you want, save it (and repeat).

Start a new workbook and record a macro when you open one of the CSV files.
Continue recording when you format it.

Then you can tweak the macro to look more like:

Option Explicit
Sub testme()

Dim myFileNames As Variant
Dim iCtr As Long
Dim wkbk As Workbook
Dim NewFileName As String

myFileNames = Application.GetOpenFilename _
("CSV Files, *.csv", MultiSelect:=True)

If IsArray(myFileNames) = False Then
Exit Sub 'user hit cancel
End If

For iCtr = LBound(myFileNames) To UBound(myFileNames)
NewFileName _
= Left(myFileNames(iCtr), Len(myFileNames(iCtr)) - 4) & ".xls"
Set wkbk = Workbooks.Open(Filename:=myFileNames(iCtr))
'do your formatting

'save the workbook
Application.DisplayAlerts = False
wkbk.SaveAs Filename:=NewFileName
Application.DisplayAlerts = True
wkbk.Close savechanges:=False
Next iCtr
End Sub

The multiselect stuff allows you to click on the first and ctrl-click on
subsequent in the File|open dialog. That way you just select the ones you want
to convert.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Chip wrote:

I have a series of CSV files that ned to be converted to XLS and reformatted
at the same time. Is there any way to click on the CSV file and have it open
into a preformatted XLS spread sheet that can then be saved in the XLS file
type?


--

Dave Peterson
 
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
CSV formatted files open odly in Excel 2000 Janski Excel Discussion (Misc queries) 3 November 24th 05 07:58 PM
Excel 2003 Inserted pictures formatted in PNG format. WildBill Excel Discussion (Misc queries) 0 November 18th 05 09:03 PM
How to change default cell format to "Text" rbecerra Excel Discussion (Misc queries) 2 September 10th 05 04:29 AM
Click on Excel Doc Starts Excel but Excel does not Open the Doc. Mark Excel Discussion (Misc queries) 3 August 24th 05 02:33 PM
trying to open an excel file in excel 2003 Edward Letendre Excel Discussion (Misc queries) 1 June 3rd 05 02:22 PM


All times are GMT +1. The time now is 09:56 PM.

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"