OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Need help with Calc to Txt File? (Could do it in excel!)

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
GopherMouse
Newbie
Newbie


Joined: 24 Mar 2006
Posts: 1

PostPosted: Fri Mar 24, 2006 3:12 pm    Post subject: Need help with Calc to Txt File? (Could do it in excel!) Reply with quote

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!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group