Tim,
The data file used to be output sent directly to a printer. It is now sent
to a hard disc file to be read online. The current program, written in
assembler and invoked by IE for example, reads the data file and writes
either HTML or text lines to stdio back to the browser which displays the
data.
I'm enhancing this program to have Excel be a third target. The HTML
CONTENT-TYPE it creates invokes the Excel application. The program also
formats the data into columns by using <table<tdline1 data</td<tdline2
data</td...</table. The formatting seems to work very well except for the
problems I listed at the first post.
If you're wondering why assembler, the shop has an entire environment built
around assembler code running under Linux. There's a lot of history. So,
running
VB code isn't an option. This is why I'm asking how to do this from
the perspective of an HTML file as input to Excel.
From HTML (as input to Excel), I don't know how to force the use of a fixed
sized font, etc.
Some of the problems I listed may be Excel problems when using HTML as input
(number formatting issues). Maybe Excel just doesn't do what I'm needing
(using the font I want).
Thanks,
Scott
"Tim Williams" wrote:
How are you getting the information into Excel ? Are you using a macro or
some other method ?
ActiveCell.Font.Name = "Courier" 'proportional font
ActiveCell.Interior.Color = vbRed shading
ActiveSheet.Columns(10).NumberFormat = "0.00"
'replace trailing/leading spaces and single quotes
Dim c As Range
For Each c In ActiveSheet.UsedRange.Cells
c.Value = Trim(c.Value)
c.Value = Replace(c.Value, "'", "")
Next c
Your best bet is to turn on the macro recorder and do some formatting, then
look at the code.
Tim
"scottb2" wrote in message
...
I'm trying to use fixed format information in a file (used to be printed)
to
Excel 2003. One goal is to try to make the spreadsheet look as close to
the
data file as possible. I'm also trying to disturb the user's environment
as
little as possible and drive Excel from the program. I'm currently
filling
in the proper cells with the right data but have some limitations that I'd
like to overcome.
Can I tell Excel to use a fixed-sized font?
Can I tell Excel to use a red background for selected cells without
knowing
the cell number?
A column may not always have numbers (perhaps column headers, etc.) Can I
indicate that if a cell in column 10, 11, or 13 is numeric, it should be
formatted to always have two decimal places? It should still remain a
number
and not be converted to text, kind of like using
Format-Cell-Number-Currency.
Sometimes a number (250.00 and -332.11, both with following spaces) will
not
be converted to a number. The cell has an error message of "The number in
this cell is formatted as text or preceeded by an apostrophe." What do I
need to do to get rid of the error?
I tried preceeding all numbers in the column with an "=" so the numbers
ended up being "= 250.00" [space follows the equal] or "=-322.11" [minus
sign
replaced the space"]. That caused a different error on other cells: "The
formula in this cell differs from the formulas in this area of the
spreadsheet." Interestingly enough, the same column has one value of 6.02
with the 2nd error message and one value of 6.02 without.
The solution to this whole formatting mess may be to format all numbers as
text and let the user format them to be numeric if that's needed.
I know this is a bunch of questions. Thanks for your time.
Scott