Text formatted as "General" in Excel 2002. How do I avoid that?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an application that generates a file. I can give any kind of extension
name to this file generated. I have full control on output generated in this
file. Meaning, I can put quotes, single qute, tab, etc anywhere I want.

My objective is to open up this file in Excel. When I do that, some text
like "00010010" ends up becoming 10010. How do I avoid that from happening.
Note that since the file extension is already a ".xls" or a ".csv", Excel
opens it up right away, rather than going through a formatting steps that I
would normally go through for opening up a ".txt" file.

What I have tried so far is
1) "00010010"
2) '00010010'
3) '00010010
None of these produces the desired result. I would appreciate any help
provided. thanks in advance.
 
Example,, say your numbers are in Column D
In a standard module enter:

Sub Macro1()
' Macro1 Macro
' Macro recorded 8/11/2006 by Jim May
Columns(4).NumberFormat = "00000000"
End Sub

Ans run it!!
 
Please note that I would not be doing anything in Excel. The file that I
prepare in a separate application is sent out via email as an attachment. And
all I expect the receiver at the other end to do is to open this attachment
which has ".xls" or ".csv" extension. And hopefully Excel opens it up fine.
Only problem I face is that my text "00010010" ends up becoming a "10010"
when opened up. So right now I am playing around with different way of
putting this text "00010010", for e.g. single quote, double quote, etc. Any
idea to achieve my objective?
 
Hello Chris,
Thank you for your post. Yes, ".txt" would be an easy way out. But
unfortunately, I am doing this for few users, to whom, that would be too much
to ask. Note that I am sending the file I generate as an email. So, all they
would want to do at their end is to click on the attachment and be formatted
right in Excel. If the attachment had a ".txt" extension, they would have to
save that file, then open it with excel and ofcourse use the format wizard
and all.
 

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

Back
Top