sqlexcelextractpowerbuildervba

Syntax for Excel Object. Change Number Formatting


I made an application that extracts records from an SQL Select to Excel.
I would like to change the number formatting of the excel columns before saving. I made the EXCEL OLE Object then writes data on to it

Excel_Sheet.Cells[i + j,k] =  s_col

I would like to change the number format depending on the column type. I already know how to get the column type but have no luck in changing the number format.

I used these: to make the headers Bold and change the width depending on the data using AutoFit.. All I've found in the internet:

Excel_Sheet.Range(s_into_row + String(j) + ":" +s_into_col + String(j)).Select
Excel_Obj.Selection.Font.Bold = True

Excel_Sheet.Range("A"+String(j)+":A"+String(j)).Select
Excel_Sheet.Columns(s_into_row + ":" + s_into_col ).EntireColumn.AutoFit

I am using powerbuilder


Solution

  • I haven't worked with Powerbuilder but have you tried something like

    Excel_Sheet.Columns(s_into_row).NumberFormat = "0.00"