Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to import a text file and save it as a normal excel file in VB
Script. I first recorded a macro that has steps to open the text file parse it into columns and save it into a excel 2003 file. However when I copy and past the macro with changes necessary for the VB script , vb script either fails in the save-as step or brings up an interactive diaglog box for saving. What is the way todo with out bringing up the diaglog box. Below is my simple code.. Dim oXcel Set oxcel = CreateObject("excel.Application") oxcel.workbooks.add oxcel.workbooks.OpenText "MyFile.txt" oxcel.Rows("1:1").Select oxcel.Selection.Font.Bold = True oxcel.Columns("A:J").Select oxcel.Range("J1").Activate oxcel.Selection.Columns.AutoFit ON Error Resume Next oxcel.workbooks.SaveAs "MyFile.xls",4 if err.number < 0 then wscript.echo "SaveAs error:",err.description end if On Error goto 0 oxcel.quit Set oxcel = Nothing ===== thanks Newbie Scriptor |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I save an excel file as a file with undelimited text | Excel Discussion (Misc queries) | |||
How do you save an excel file to be read as IBM-type text file ? | Excel Worksheet Functions | |||
How can I save a file as a comma-delimited text file in Excel? | Excel Discussion (Misc queries) | |||
Excel VBA - open text file, replace text, save file? | Excel Programming | |||
Excel VBA to save .xls file as UTF-8 text file | Excel Programming |