Go back to previous page
Forum URL: http://www.dombom.com/cgi-bin/dcforum/dcboard.cgi
Forum Name: FatBomb
Topic ID: 11
Message ID: 2
#2, RE: "Readjusting" Databases for FatBomb
Posted by totenmaske on Jun-01-04 at 06:50 AM
In response to message #1
I've had some emails requesting the Excel Macro...

------------------------ Macro -----------------------

Sub ExportDB()

' This macro saves the active worksheet to a pipe-delimited flat file at c:data.txt

Dim SrcRg As Range

Dim CurrRow As Range

Dim CurrCell As Range

Dim CurrTextStr As String

Dim ListSep As String

Dim DataTextStr As String

ListSep = "|"

Set SrcRg = ActiveSheet.UsedRange

Open "C:data.txt" For Output As #1

For Each CurrRow In SrcRg.Rows

CurrTextStr = ""

For Each CurrCell In CurrRow.Cells

CurrTextStr = CurrTextStr & CurrCell.Value & ListSep

Next

While Right(CurrTextStr, 1) = ListSep

CurrTextStr = Left(CurrTextStr, Len(CurrTextStr) - 1)

Wend

'Added next line to put | at end of each line

CurrTextStr = CurrTextStr & ListSep

Print #1, CurrTextStr

Next

Close #1

End Sub

------------------------ Macro -----------------------


----------------------
Stanley aka Totenmaske

Affiliate-Blog.com
My FatBomb Feeds
Cherry Bomb XML List
GothSeek.com - the Gothic Search Engine - Powered by FatBomb!