Works great.
Two things made me want to cry and feel a little stupid

1 - I misunderstood the UDF name and thought it was a UDF to set the format of a cell and just had a wrong header. xlRangeFormatFont would be more obvious. Reading the top header of the library also wouldn't hurt I guess

2 - One should first initiate Excel and create a workbook before trying to set the formatting on one or more cells. My bad. Been looking at it for way to long and got kinda codeblind and missed this obvious error.

All is working just fine now.
I have it reading some default customer info from and ini file and reading an ad feed from a txt file supplied by the customer.

 Code:
Break on

;Call all functions
$udf = Dir(@SCRIPTDIR + "\functions\*.udf")
While $udf <> "" AND @ERROR = 0
	Call @SCRIPTDIR + "\functions\" + $udf
 	$udf = Dir()
Loop

;Remove invalid characters from  the time and date.
$date = Join(Split(@DATE, "/"), "")
$time = Join(Split(@TIME, ":"), "")

;Read default customer values from ini file.
$name = ReadProfileString(@SCRIPTDIR + "\test.ini", "Custdata", "Name")
$phone = ReadProfileString(@SCRIPTDIR + "\test.ini", "Custdata", "phone")
$website = ReadProfileString(@SCRIPTDIR + "\test.ini", "Custdata", "website")
$email = ReadProfileString(@SCRIPTDIR + "\test.ini", "Custdata", "email")

;Set Excel filename
$xlFileName = @SCRIPTDIR + "\" + $name + "Feed-" + $date + "-" + $time + ".xlsx"

;Initialize excel instance
$xlPtr = xlInit()

;Create workbook.
$rc = xlBookCreate($xlPtr, 1,)

;Set format for row A to preserve the leading 0.
$rc = xlRangeFormatNum($xlPtr, "A:A", "Text", ,"Sheet1")

;Write header row.
$rc = xlRangeValue($xlPtr, "A1", "Phone",)
$rc = xlRangeValue($xlPtr, "B1", "Website",)
$rc = xlRangeValue($xlPtr, "C1", "E-mail",)
$rc = xlRangeValue($xlPtr, "D1", "Value",)
$rc = xlRangeValue($xlPtr, "E1", "Text",)
$rc = xlRangeValue($xlPtr, "F1", "Category",)

;Read feed into array.
$file = ReadFile(@SCRIPTDIR + "\test.txt")

;Set line index for Excel.
;Start at line 2 because lines 1 contains column names.
$lineindex = 2

;Do stuff for each line in the feed.
For Each $line in $file
	;Split line.
	$line = Split($line, "#")
	;Remove leading and trailing sapces.
	For $i = 0 to Ubound($line)
		$line[$i] = Trim($line[$i])
	Next
	;Write data to excel if first ellement is not empty.
	If $line[0] <> ""
		$aData = xlRangeValue($xlPtr, "A" + $lineindex, $phone,)
		$aData = xlRangeValue($xlPtr, "B" + $lineindex, $website,)
		$aData = xlRangeValue($xlPtr, "C" + $lineindex, $email,)
		$aData = xlRangeValue($xlPtr, "D" + $lineindex, $line[0],)
		$aData = xlRangeValue($xlPtr, "E" + $lineindex, $line[1],)
		$aData = xlRangeValue($xlPtr, "F" + $lineindex, $line[2],)
		$lineindex = $lineindex + 1
	EndIf
Next

;Change sheet name
$rc = xlSheetName($xlPtr, $name)

;Save excel file
$rc = xlFile($xlPtr, 2, $xlFileName)

;Quit excel
$rc = xlQuit($xlPtr)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.