View Single Post
  #2   Report Post  
Miyahn
 
Posts: n/a
Default

"Olivia Towery" wrote in message
I am using the CreateObject("Excel.Application") to create a workbook from
three separate tables in a sql db. This works great and compiles three
separate sheets to one workbook. My issue is that I need the cell
formatting to be text for all entries. However the Excel spreadsheet will
take my data - 05/05 and translate to 05-May OR my data 0140 and translate
to 140.

How can I write the vbscript to format all cells to text?


Like this.

With CreateObject("Excel.Application")
.Visible = True
With .Workbooks.Add(1).Sheets(1)
.Cells.NumberFormat = "@"
.Cells(1, 1).Formula ="05/05"
End With
End With

--
Miyahn (Masataka Miya****a) JPN
Microsoft MVP for Microsoft Office - Excel(Jan 2005 - Dec 2005)