Solved

Autoformat RTF

Posted on 2004-08-05
10
320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

 
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
 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
word 2016 1 40
Problem Office 2016 auto-activation using MAK Key 3 324
Word 2010 VBA - Search, Select and Delete macro 8 39
MS Word Hangs in Picture Insert 6 22
There is a feature provided by MS Word that lets you create an Table of Contents for your Word document automatically. To use this feature for other documents there are two steps involved,   1.  Prepare your document for a table of contents (he…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
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 …
Suggested Courses

751 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