Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can style formatting of an inserted word document be retained?

5 views
Skip to first unread message

James Boyle

unread,
Apr 11, 2002, 6:54:30 PM4/11/02
to
I am using Word 2000 and want to include a portion of another Word 2000
document in my document. The other document uses styles that are named
the same as my document but are formatted differently.

When I insert the other document into mine it seems that the formatting of
the styles in my document take precedence and the formatting of the inserted
document changes. It looks horrible since the formatting of the styles
don't
match.

I want only one Word 2000 file and don't want to mess with Master
Documents or the Tech-Tav macros. Is there a way to tell Word 2000
to retain the formatting of the styles of the inserted document?


Jim Boyle

Cindy Meister -WordMVP-

unread,
Apr 12, 2002, 10:53:15 AM4/12/02
to
Hi James,

> Is there a way to tell Word 2000
> to retain the formatting of the styles of the inserted document?
>

No. (And neither MasterDocs nor TechTav can do it, either) You'll
have to go into the document you're inserting and change the style
names, so that they'll be retained.

You can do this in Tools/Templates and Addins/Organizer.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

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

James Boyle

unread,
Apr 12, 2002, 4:32:37 PM4/12/02
to
Cindy,

Thanks for the response.

However, when I get to the Organizer via Format/Style/Organizer...
and I select a style to rename, it seems to create an alias instead.
Some styles can be renamed but some create aliases.

I can't get to the Organizer from the menu path you suggest because I
have some template that does not exist.

Also there are dozens of styles in this document. So I thought I could
create a macro to use to simply add a prefix to the style name for the
style I have selected in the organizer. But I can't record a macro once
the Organizer dialog is displayed. And if I start the record and then
bring up the Organizer, the macro recorded is for one specific style
that was selected.

I thought macros were just like recording keystrokes and that could
be repeated over and over. But the VBA that is created calls a
function Application.OrganizerRename().

What I thought I could do was select a style in the Organizer then run
a macro that performs an ALT-R to invoke the rename command button
and then invokes the Home key to move to the front of the style name in
the Rename dialog edit window and then add a specific prefix and then
invokes Enter to finish the rename and close the Rename dialog.

Seems like a simple process. I could then select the next style and hit
the macro key sequence and it would rename without me manually typing
the prefix over and over. But the recorded macro calls the function above
and does not record the key sequence.

Any ideas on why I am getting aliases instead of renamed styles and any
suggestions on how to create a macro to repetitively rename styles?

Thanks,

Jim


"Cindy Meister -WordMVP-" <CindyM...@swissonline.ch> wrote in message
news:VA.00005a34.008c3da9@speedy...

Klaus Linke

unread,
Apr 12, 2002, 6:08:32 PM4/12/02
to
Hi Jim,

The cleanest solution if your inserted document is small would
be to split it into single pages and "Edit > Paste Special > Microsoft
Word Document Object". You can still edit these inserted documents
by double-clicking on them, and they have their own sets of styles.

Or you can rename all the styles with a macro, even the built-in
styles (see below).
I surely wouldn't do that on a regular basis (a large number of styles
quickly make a document unmanageable), but it might do for a one-off.

The following macro renames all styles in the document by appending
a * to the style name (heading 1 is changed to heading 1* ...).
Since heading 1* isn't recognized as a built-in style anymore, I
can then rename it to anything I want (for example to H1).

The macro works by saving the file in RTF format, and changing
all style names in the header of the RTF file.

The usual disclaimer: Use the macro at your own risk

Greetings, Klaus


Sub ChangeStyleNames()
' The macro appends a * to all style names
' It thus changes built-in styles to ordinary styles
Dim myRange As Range
Dim MsgText
Dim myFileName

MsgText = "Cancel if you have not saved the file"
If MsgBox(MsgText, vbExclamation + vbOKCancel, _
"Danger") = vbCancel Then
End
End If

myFileName = ActiveDocument.Name
If InStr(1, myFileName, ".") > 0 Then
myFileName = Left$(myFileName, _
InStr(1, myFileName, ".")) & "RTF"
Else
myFileName = myFileName & ".RTF"
End If
ActiveDocument.SaveAs _
FileName:=myFileName, _
FileFormat:=wdFormatRTF
ActiveDocument.Close
Documents.Open _
FileName:=myFileName, _
ConfirmConversions:=False, _
Format:=wdOpenFormatText
Set myRange = ActiveDocument.Content
myRange.Find.Execute _
FindText:="\{\\stylesheet*\}\}", _
MatchWildcards:=True
myRange.Find.Execute _
FindText:=";\}", _
ReplaceWith:="*^&", _
MatchWildcards:=True, _
Replace:=wdReplaceAll
ActiveDocument.Save
ActiveDocument.Close
Documents.Open _
FileName:=myFileName
End Sub


"James Boyle" <boy...@bogus.cat.com> schrieb im Newsbeitrag
news:OOGMwEm4BHA.568@tkmsftngp07...

0 new messages