GopherMouse Newbie

Joined: 24 Mar 2006 Posts: 1
|
Posted: Fri Mar 24, 2006 3:12 pm Post subject: Need help with Calc to Txt File? (Could do it in excel!) |
|
|
Hi All
I am just starting with Oo and am looking to try and convert my excel files - Macros included!
I have the following code with generates a text file from an excel file:
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;\\oscar\bin.txt", Destination:=Range("A1"))
.Name = "MIne"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(2, 2, 2, 2, 2, 2, 2)
.TextFileFixedColumnWidths = Array(11, 7, 19, 4, 40, 23)
.Refresh BackgroundQuery:=False
End With
Columns("F:G").Select
Selection.Delete Shift:=xlToLeft
Rows("1:4").Select
Selection.Delete Shift:=xlUp
Columns("D:D").Select
Selection.Insert Shift:=xlToRight
Selection.NumberFormat = "General"
Cells.Select
Selection.RowHeight = 20
ActiveWorkbook.Save
Now i understand the first part and have got so far:
set oSheet = ThisComponent.CurrentController.ActiveSheet
With oSheet.QueryTables.Add(Connection:= _
"TEXT;\\oscar\bin.txt", Destination:=Range("A1"))
oSheet.Name = "MIne"
But from now on I get object errors.
Please can someone help, or get me started?
Thanks all!!! |
|