Solved

Autoformat RTF

Posted on 2004-08-05
10
311 Views
Last Modified: 2008-03-06
Hi,
I have a template which recieves data and populates some bookmarks.
The data comes from a database application and one of the fields is RTF (with font info bundled).
The upshot being is that I end up with a doc that is times new roman 12pt for everything except a couple of lines with are 10pt Tahoma.
Any ideas on how to make this bookmark data conform to the TNR 12pt that the rest of the text is?
Format the bookmark (possible?)
Macro?
something else?

Cheers
Jay
0
Comment
Question by:QPR
  • 4
  • 4
  • 2
10 Comments
 
LVL 37

Assisted Solution

by:Joanne M. Orzech
Joanne M. Orzech earned 60 total points
ID: 11738461
Easiest way is Control A, and change the font to Times New Roman 12.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 65 total points
ID: 11738500
Perhaps you could explain how you are populating your bookmarks. Are you using a macro?

On many fFelds you can use the Mergeformat switch which does what you are asking for.

If you are using a macro, some minor modifications could do it.



0
 
LVL 29

Author Comment

by:QPR
ID: 11740084
3rd party application.
Access/SQL server.
Ability to assign variables to references/bookmarks within the word template.
When a certain event fires these variables are passed (auto) to the template and the bookmarks populated. Bit like a single document mail merge.
The end user simply prints the document and stuffs it in an envelope.... apart from the bit where they have to highlight the bookmark containing the RTF data and change the font. No biggie but would be nice to have them not have to do this step.
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 11742487
Not sure if this will help, but try Insert, Field, Mergefield, and make sure "preserve formatting during updates" is checked.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 11745611
You could run this macro

Sub ChangeFont()
    With ActiveDocument.Content.Find
        .Font.Size = 10
        .Font.Name = "Tahoma"
        .Replacement.Font.Size = 12
        .Replacement.Font.Name = "Times New Roman"
        .Format = True
        .Execute Replace:=wdReplaceAll
    End With
End Sub

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 29

Author Comment

by:QPR
ID: 11748247
Hi Graham.
I changed your code to reflect what I'm trying to do but nothing is changing.
Have I used the wrong event? I don't fully understand the relationship between the template and the document other than the doc is a copy from a blueprint so to speak!

I opened the template and went to tools-macro-vb editor added this and saved.

Public Sub Document_Open()
    With ActiveDocument.Content.Find
        .Font.Size = 8.5
        .Font.Name = "Tahoma"
        .Replacement.Font.Size = 12
        .Replacement.Font.Name = "Times New Roman"
        .Format = True
        .Execute Replace:=wdReplaceAll
    End With
End Sub


The RTF field in the resulting .doc is still tahoma 8.5
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 11749590
Did you try what I suggested in my first post?  If it works - that's the same macro Graham wrote.... Just curious.
0
 
LVL 29

Author Comment

by:QPR
ID: 11749630
HI JOrzech.
You mean the Control + A post?
I'm trying to achieve this with zero end user interaction if possible.

I looked at your other post...
Insert, Field, Mergefield, and make sure "preserve formatting during updates"
But not knowing huge amounts about bookmarks/merges I couldn't quite see what you meant. However, I did look where you suggested and the preserve formatting box is checked.

The template/document is launched by a 3rd party application. The on open sub can be found in both the template and the resulting document. However 2 things are noticed:
1. It doesn't work! (the rtf field is still tahoma)
2. No macro warnings when document opens (I'm *guessing* that this is because Word is being launched by the app as opposed to a user and so messages are suppresed (correct/rubbish?)
0
 
LVL 29

Author Comment

by:QPR
ID: 11749916
Hmmmm I've found a way to handle this from within the 3rd party app. Wrap a replace function around the call for the RTF text.
What should I do now? Have the Q deleted or split between all who answered?
Whats the norm protocol???
Come to think of it I'll split it while I'm here keep everything tidy

Cheers
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 11752691
Thanks QPR!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Like many others, we try and discourage users from printing documents unnecessarily and instead send or share them electronically. However, this doesn't always work and documents are still printed. With this simple solution, if the user tries to …
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now