Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default Literally displaying imported cells with and tags

Hi,
I'm exporting contents to excel from a web application. Each row looks
like this:


"3101" "American Express" "Fort Lauderdale" "FL" "Deployed" "Windows
2001R1" "<![CDATA[<HTML
<BODY
<P
<BIMPORTANT:</B We have updated server. You must click the button
again to receive your account information.
<P
More text goes here
</P
</BODY
</HTML]]"

However, when the file is opened in Excel only the text in the last
column is displayed (the tags and all the other cells are missing). How
do I get excel to just print all columns and the literal contents
without trying to do anything smart? I know if I get rid of the <HTML
and <BODY tags it works, but unfortunately I need to leave them in -
and they need to show up as <HTML and <BODY.
Any ideas?

thanks,
Orlando

  #2   Report Post  
Jon Peltier
 
Posts: n/a
Default

Orlando -

Here's an ancient piece of code I use for this:

Sub inputTXTfile()
' input text file line by line without interpreting html tabs
' open new sheet first and select home cell

Dim linein As String, fh As Integer, FileName As String, lineNum As Double

FileName = Application.GetOpenFilename
If FileName = "False" Then Exit Sub
Application.ScreenUpdating = False
lineNum = 0
fh = FreeFile
Workbooks.Add

Open FileName For Input As fh
Do Until EOF(fh)
Line Input #fh, linein
ActiveCell.Offset(lineNum, 0) = linein
lineNum = lineNum + 1
Loop
Close #fh

Application.ScreenUpdating = True
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______


wrote:

Hi,
I'm exporting contents to excel from a web application. Each row looks
like this:


"3101" "American Express" "Fort Lauderdale" "FL" "Deployed" "Windows
2001R1" "<![CDATA[<HTML
<BODY
<P
<BIMPORTANT:</B We have updated server. You must click the button
again to receive your account information.
<P
More text goes here
</P
</BODY
</HTML]]"

However, when the file is opened in Excel only the text in the last
column is displayed (the tags and all the other cells are missing). How
do I get excel to just print all columns and the literal contents
without trying to do anything smart? I know if I get rid of the <HTML
and <BODY tags it works, but unfortunately I need to leave them in -
and they need to show up as <HTML and <BODY.
Any ideas?

thanks,
Orlando


  #3   Report Post  
 
Posts: n/a
Default

Hi Jon,

Thanks for replying. I'll go figure this out, but if you have a second
can you explain where the Application and ActiveCell objects come from?
I was just writing directly to Response.Write, setting the content type
to excel, and letting Windows just open the file naturally from the
association. It looks like you're directly manipulating excel, which is
an avenue I haven't investigated before.

Thanks again,
Orlando

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Jon's code is a macro that's run from inside excel.

Application is Excel (itself) and Activecell is a range object within excel.
Activecell represents the cell that's selected (or if the selection is
multi-cells, it represents the "white" one in that selected area).

You may want to read David McRitchie's intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

wrote:

Hi Jon,

Thanks for replying. I'll go figure this out, but if you have a second
can you explain where the Application and ActiveCell objects come from?
I was just writing directly to Response.Write, setting the content type
to excel, and letting Windows just open the file naturally from the
association. It looks like you're directly manipulating excel, which is
an avenue I haven't investigated before.

Thanks again,
Orlando


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"