Charles
Fri Dec 19 19:38:24 CST 2003
Suzanne's suggestion is the best way to do this. Put the styles in your
document templates.
However, it is possible, just not easy.
You can include a procedure (macro) in your Add-In to copy your styles to a
new document using the Organizer method. Then, in each template that is to
use that procedure you need to put the following in an AutoNew macro or in
the Document_New event handler:
Application.Run MacroName:= GlobalStyles
This assumes that your procedure is named GlobalStyles. Below is a procedure
I use to transfer pleading numbering styles from a global template to an
existing document. It could be run instead from an AutoNew macro using this
method. (I would then get rid of the first message box.)
Sub PleadingStyleTransfer()
'
' PleadingStyleTransfer Macro
' Macro written 14 November 2001 by Charles Kyle Kenyon
'
On Error GoTo NoDocument 'In case called when no document is open.
Dim sThisTemplate As String
Dim sTargetDoc As String
Dim i As Integer
Dim iCount As Integer
Dim rResponse As Variant 'vbMsgBoxResult in Word 2000 or later
sThisTemplate = ThisDocument.FullName
sTargetDoc = ActiveDocument.FullName 'generates error if no document
open
rResponse = MsgBox(Prompt:="This command redefines your Body Text Style
and" _
& vbCrLf & "Heading Styles 1-9. Are you sure you want to do this?" _
& vbCrLf & vbCrLf & "If you are not sure, answer 'No' and make a
backup of your document." _
& vbCrLf & "Then run the command to copy the styles again.", _
Title:="Are you sure you want to redefine your styles?", _
Buttons:=vbYesNo + vbExclamation)
If rResponse = vbNo Then Exit Sub
On Error Resume Next
' Copy Body Text and Pleading Styles to Active Document
For i = 1 To 3 ' copy styles three times
StatusBar = "Copying Styles - Round " & i & " of 3"
With Application
.OrganizerCopy Source:=sThisTemplate, _
Destination:=sTargetDoc, Name:="Body Text,bt,bt1", Object:=
_
wdOrganizerObjectStyles
StatusBar = i & "/3: Body Text"
For iCount = 1 To 9
.OrganizerCopy Source:=sThisTemplate, _
Destination:=sTargetDoc, Name:= _
"Heading " & iCount & ",h" & iCount & ",Pleading " &
iCount _
& ",p" & iCount, Object:= _
wdOrganizerObjectStyles
StatusBar = i & "/3: Pleading " & iCount & " copied"
Next iCount
End With
Next i
StatusBar = "All styles copied."
' Change to Pleading 1 style?
rResponse = MsgBox(Prompt:="Change to Pleading 1 style and go into
Outline view?", _
Buttons:=vbYesNo, Title:="Pleading Styles Imported - start
writing?")
If rResponse = vbYes Then
Selection.Style = ActiveDocument.Styles("Heading 1,h1,Pleading
1,p1")
ActiveWindow.ActivePane.View.Type = wdMasterView
Else 'not now - then reminder
MsgBox Prompt:="The style to start your pleading is Pleading 1 or
p1." _
& vbCrLf & "It is probably easiest to work in Outline view."
End If
Exit Sub
NoDocument:
MsgBox Prompt:="Sorry, this command is only available when you have a
document open." _
& vbCrLf & "It should be used after you have your caption set up.", _
Title:="No document open!", Buttons:=vbExclamation
End Sub
That may be more than you wanted to know or try at this point!
Note that the procedure copies the styles three times. Don't take this out
if you are using styles that are linked to other styles or they'll be
scrambled.
The following is general advice about changing from WP to Word. You may not
need it but if you haven't reviewed the web pages listed, you should.
Unfortunately, the links to addbalance.com won't work yet. I am working on
moving my website and it is taking me forever. (I should probably be
focusing on that rather than chatting here!)
Word and Word Perfect work very differently from one another. Each program's
methods have strengths and weaknesses; but, if you try to use one of these
programs as if it were the other, it is like pushing on a string! You can
easily make a lot of extra work for yourself. If you are unwilling to take
the time to learn to use Word's methods, you should stick to using Word Pad.
You'll have a lot less grief, although you'll miss out on a lot of raw
power.
See <URL:
http://www.addbalance.com/word/wordperfect.htm>
<URL:
http://www.mvps.org/word/FAQs/General/WordVsWordPerfect.htm>
<URL:
http://www.mvps.org/word/FAQs/General/TipsAndGotchas.htm>
<URL:
http://www.mvps.org/word/FAQs/General/RevealCodes.htm>
<URL:
http://www.mvps.org/word/FAQs/General/WordPerfectConverters.htm>
<URL:
http://businesssoft.about.com/compute/businesssoft/library/blconvert.htm>
for information on Word for Word Perfect users.
For more:
<URL:
http://www.mvps.org/word/FAQs/Customization/CreateATemplatePart2.htm>
<URL:
http://www.mvps.org/word/FAQs/Customization/CreateATemplatePart1.htm>
<URL:
http://www.addbalance.com/usersguide/templates.htm>
<URL:
http://www.mvps.org/word/FAQs/Numbering/WordsNumberingExplained.htm>
<URL:
http://www.addbalance.com/usersguide/styles.htm>
<URL:
http://www.mvps.org/word/FAQs/Customization/WhatTemplatesStore.htm>
In Word 2000 (or later) You can get the function keys to display in a
special toolbar at the bottom of the screen if you want (something like
pressing F3 twice in WP). The following macro will do this.
Sub ShowMeFunctionKeys()
Commandbars("Function Key Display").Visible = True
End Sub
Learn about Styles - really learn! <URL:
http://www.addbalance.com/usersguide/styles.htm> I resisted for years and
now regret every day of those years because although that string was still
very hard to push, it kept getting longer and longer, and had some very
important projects tied to it!
--
Charles Kenyon
Word New User FAQ & Web Directory:
<URL:
http://addbalance.com/word/index.htm>
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL:
http://addbalance.com/usersguide/index.htm>
See also the MVP FAQ: <URL:
http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
"Allison Orange" <aorange@psc.state.fl.us(remove to reply)> wrote in message
news:uChnKCkxDHA.3468@TK2MSFTNGP11.phx.gbl...
> We are using Word 2002 SP2 on Windows 2000 SP4 PC's. We are migrating
from
> WordPerfect 9 and are doing fairly well so far. We have created an
add-in,
> library.dot on a network drive, which we copy down to users' PC's upon
login
> in order to give them access to macros which should work across templates.
> That way, we can make changes to the network copy which gets pushed to the
> users at their next login.
>
> I now want to give them access to new styles we've created which need to
> work across templates, but I read in the newsgroups, that although
toolbars
> and macros work from add-ins, styles don't. How can I push the new styles
> to our users that they can use across different template types?
>
> Just in case there is a better way to do it, the styles are for the
purpose
> of double-indenting a block quote. Although, Word has a block quote
style,
> we need ones with varying amounts of indention, so I created new styles
with
> the correct indention.
>
> TIA,
> Allison Orange
> Systems Project Administrator
> Florida Public Service Commission
> aorange@psc.state.fl.us
>
>