Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Excel.Application casting data types

Posted on 2003-02-25
Medium Priority
Last Modified: 2012-08-13
I'm using Excel.Application to create a spreadsheet from within an asp page. One of the columns contains 5 character codes which should be treated as text, but sometimes they are numeric and have leading zeros, which Excel removes when the spreadsheet is opened. How do I cast the data type of this column as text so that the zeros will be displayed?
Question by:jennieh

Accepted Solution

lavinder earned 300 total points
ID: 8015265

 simply use something like this
 e.g. sets the second column's format to text

 Selection.NumberFormat = "@"


Author Comment

ID: 8015536
I used the following and it worked:

m_oExcelWS.Range("F:F").NumberFormat = "@"

Thanks very much!!!

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question