Programming Open and SaveAs

G

Guest

I am experienced with VB and .Net, but not so experienced with Word.

In Word, I can open a url, eg "http://moneycentral.msn.com/home.asp" and
then SaveAs plain text, thereby removing all of the html codes. So far so
good.

I've figured out how to automate this functionality via Word Automation, but
with some difficulty and problems. Word seems to get bent with locked files,
and SaveAs requires that I actually save a file which I don't really want to
do. And sometimes I get popups, eg a warning about SaveAs losing cascading
styles, etc. So far, not so good.

What I really want is the file transformation of Word's SaveAs Plain Text
but without any Word baggage at all. I have a Visual Basic .NET string
variable with the text of a url (what you see with IE View Source), and what
I want is a function that returns a string with all the html stripped out (ie
what SaveAs does but without any file IO). The .NET documentation hints at
converters of this sort, but a hint leaves me short.

Any ideas?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?QU1lcmNlcg==?=,
What I really want is the file transformation of Word's SaveAs Plain Text
but without any Word baggage at all. I have a Visual Basic .NET string
variable with the text of a url (what you see with IE View Source), and what
I want is a function that returns a string with all the html stripped out (ie
what SaveAs does but without any file IO). The .NET documentation hints at
converters of this sort, but a hint leaves me short.
Two possibilities come to mind.

1. Just read the document text into a string variable:
sDocContent = doc.Range.Text

2. Copy the text to the Clipboard, then use the PasteSpecial functionality to
paste as plain text

Note: This is an end-user newsgroup, which you ought to have noticed if you
read a few messages before posting. An office.developer or word.vba group would
have been better for your question. You'd have likely gotten a reply long before
this...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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