Log in

View Full Version : Solved: Updating Styles from DOTX



Paul_Hossler
10-19-2010, 05:16 PM
I've been creating templates that have the set of styles I need (or at least think I want) for different projects (thanks, Gerry:hi: )

I'll get documents from people who have manually applied almost all their formatting and/or messed up their styles

What's the best / fastest / flexablest way to apply the styles from one of my DOTX's and update the open doc's styles?

1. I tried attaching one of my style-holding templates checking (and not checking) 'Automatically Update Document Styles' but didn't seem to work

2. I recorded an Organizior macro (sample below)


Application.OrganizerCopy Source:= _
"\AppData\Roaming\Microsoft\Templates\Used to hold Styles.dotx" _
, Destination:="Document8", Name:="_Heading", Object:= _
wdOrganizerObjectStyles


but it gave me one line for every style

I could use that approach, but I'd have to open the template to get the .Styles and move them one at a time

Is there a better way??

Thanks

Paul
Edit: (Googled) Never knew this was here


Call ActiveDocument.CopyStylesFromTemplate("...\Templates\Style Setup.dotx")

Paul_Hossler
10-19-2010, 06:15 PM
In case anyone is interested ....



Option Explicit
Sub CopyTemplateStylesToActiveDocument()
Dim sTemplatePath As String, sFileName As String
sTemplatePath = Environ("APPDATA") & "\Microsoft\Templates"

With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = sTemplatePath
Call .Filters.Add("Word Templates", "*.dot; *.dotx; *.dotm", 1)
Call .Filters.Add("Word Documents", "*.doc; *.docx", 2)
.AllowMultiSelect = False
.Title = "Select Style Template to use ..."

If .Show > -1 Then Exit Sub

Application.ScreenUpdating = False
Call ActiveDocument.CopyStylesFromTemplate(.SelectedItems(1))
Application.ScreenUpdating = True
End With
End Sub


Worked out a whole lot easier than I figured (at least so far)

Paul

fumei
10-21-2010, 08:52 AM
Very nice Paul.

Paul_Hossler
10-21-2010, 04:27 PM
thanks, I'm still struggling to understand the Default Font and how it affects things and themes

While Word 2010 does have some nice features, personally, I'd like to just setup my styles and not have Word try to help me so much

I have a macro to clean up the QuickStyle bar, and one that builds the 40 or 50 'standard' fonts based on the way I have _Text and _Heading defined (thank you #2) so that works nicely.

But I get SO many doc's that are a hodge-podge (technical term) of manual formatting or overlapping fonts or styles, I needed something to get them closer to being in edt-able shape

Paul

fumei
10-26-2010, 11:16 AM
"I'd like to just setup my styles and not have Word try to help me so much"

So would we all my friend. So would we all.

As for the "SO many doc" that are a hodge-podge, I am afraid that is the bane of all who actually try to understand Word, dealing with those you do not give a rat's ass. I have been trying for literally decades to get people to use Word (if not properly at least remotely sanely) well.

Alas, it will never fully happen. IMO, Word 2007 and now 2010 make this issue (users not using Word properly) worse. I received a promo copy of 2010 from Microsoft and (after much dealing with OSETUP.DLL issues) installed it.

While marginally better than 2007, I still think it is a much much MUCH worse product than 2003.