RE: HTMLEditor pasting loses <BR> tags

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi,

OK ! I feel a bit lost. I work in a support organization, and very often I
have to change only a part of the text in the email body. The mails (html,
RTF,...) are coming from the customers we are supporting.

I tried to find a solution with the clipboard the selection ... but never
sorted it out ...

Have a nice day.

WBR /bertrand

"DaveS" wrote:

Hi Bettrand,

No i have not been able to solve this yet. I'm guessing I need to somehow
select the range differently, as when I debug the macro the <BR> tags never
make it into my variable.

Luckily I rarily use HTML emails...

Dave

"BertrandG" wrote:

Hello Dave,

I am Bertrand a lost French in the far notrh of Sweden ;o).

I am facing the same problem as you but I secretly hope that you solved it
could help me ...

I am quiet a new beginner in this kind of macro, so in advance I would like
you to be kind with me.

I am using Outlook2003. Did you resolve your macro and is it working with
HTML and RTF editors ?

in advance thank you for your help.

WBR / bertrand

"DaveS" wrote:

I'm trying to create a macro that can change the selected text into a
particular font and colour for RTF or HTML emails

The code below works for RTF, but for HTML the selected text loses all the
<BR> and &nbsp tags, so a highlighted list becomes one line after running the
macro.

Any ideas ?

Sub Green()
Set sInspector = CreateObject("Redemption.SafeInspector")
sInspector.Item = Application.ActiveInspector

Set RTFEditor = sInspector.RTFEditor
Set HTMLEditor = sInspector.HTMLEditor

SelText = sInspector.SelText

If (sInspector.EditorType = olEditorRTF) Then
Set textAttr = RTFEditor.SelAttributes
textAttr.Color = &H8000&
textAttr.Name = "Courier New"
ElseIf (sInspector.EditorType = olEditorHTML) Then
Set r = sInspector.HTMLEditor.Selection.createRange()
newHTML = "<font face='Courier New' color=#008000>" & _
r.Text & "</font>"
r.pasteHTML newHTML
ElseIf (sInspector.EditorType = olEditorWord) Then
Set doc = sInspector.WordEditor
Set sel = doc.Parent.Selection
With sel.Font
.Name = "Courier New"
.Color = &H8000&
End With
End If
End Sub
.



Relevant Pages

  • Re: How do I output Word 2003 merge as HTML?
    ... Is there a way I can clean up the HTML during the macro? ... when you're just running the macro as a one-off in this way. ... The results are automatically saved as .doc files. ... Dim myFile As String ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Help writing a macro
    ... Stefan is correct, you can modify the HTML, and I would also suggest you use ... InsertHTML macro below. ... Private Sub InsertHTML() ... I lay out a web page in the normal FrontPage way and when I ...
    (microsoft.public.frontpage.programming)
  • Re: How do I output Word 2003 merge as HTML?
    ... HTML templates for my website. ... The results are automatically saved as .doc files. ... you wrote the following macro to convert doc files to HTML: ... The output HTML files were saved to the "my documents folder." ...
    (microsoft.public.word.mailmerge.fields)
  • Re: File Upload and CSS
    ... Do you mean that tht resulting HTML code doesn't contain ... The problem is, that when> the page comes back to the browser, all the CSS is lost. ... I have other projects where this worked fine, and the> CSS wasn't lost, but the upload was in an html table. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Embedding a web page in a document
    ... Your notion to record the macro is excellent. ... "toggle field codes" it showed that there was a Word field code for ... Just keep in mind that Word is not a robust HTML editor. ... > issues reading images, images in subfolders, etc. than I got when I ...
    (microsoft.public.mac.office.word)