Read formatted value of cell

B

booner

I have a spreadsheet and some of the columns are formatted. For example, in
one column is a phone number. The value typed in is 8001234567 and when you
are simply viewing the cell it shows (800) 123 - 4567 (the cell is formatted
as Special: Phone Number). When I read (via vbscript) I get the
8001234567.

Set excel = CreateObject("Excel.Application")

excel.workbooks.Open "spreadsheet.xls"
excel.WorkSheets(1).Activate

phone = excel.ActiveSheet.Cells(1,1).Value

I would prefer to get the formatted value in the spreadsheet (i.e. (800)
123 - 4567).

I've searched and so far not turned up much. Any pointers would be greatly
appreciated.

BBB
 
D

Dick Kusleika

BBB

I think the Text property will return what you want.

excel.ActiveSheet.Cells(1,1).Text
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top