Re: How to use the organiser programatically by JB
JB
Thu Aug 05 03:59:42 CDT 2004
Chad DeMeyer wrote:
> To add a style:
>
> Set oStyle = ActiveDocument.Styles.Add(Name:="Cool New Style",
> Type:=wdStyleTypeParagraph)
> With oStyle
> With .Font
> 'font settings
> End With
> With .ParagraphFormat
> 'paragraph format settings
> End With
> 'etc.
> End With
>
> To add a toolbar:
>
> CustomizationContext = 'set this to a template or document object that
> represents the template or document you want to save the toolbar with, or
> use the constant NormalTemplate if you want to save it in Normal.dot
>
> Set oCmdBar = CommandBars.Add(Name:="Custom", Position:=msoBarFloating,
> Temporary:=True)
> 'Temporary argument above is optional, default is False, if set to True the
> command bar is deleted when the container application is closed
> With oCmdBar
> .Controls.Add Type:=msoControlButton,
> Id:=CommandBars("Edit").Controls("Paste").ID
> 'etc.
> .Visible = True
> End With
>
> Hope that helps
> Regards,
> Chad
>
>
> "JB" <no@way.com> wrote in message
> news:OlI95pgeEHA.4092@TK2MSFTNGP10.phx.gbl...
>
>>Chad DeMeyer wrote:
>>
>>>JB,
>>>
>>>Jonathan supplied the method by which you can use the organiser
>>>programmatically. However, I'd like to add that contrary to what you've
>>>been told, you CAN create styles and toolbars programmatically.
>>>
>>>FWIW
>>>Chad
>>>
>>>
>>>"JB" <no@way.com> wrote in message
>>>news:uhDUE1UeEHA.1048@tk2msftngp13.phx.gbl...
>>>
>>>
>>>>Hi Folks,
>>>>I have a series of templates and wizards that I wish to be able to
>>>>re-create with options on a userform. Ideally I'd like to be able to
>>>>create styles and toolbars programatically but I'm told this can't be
>>>>done (if it can be please let me know :-) ).
>>>>
>>>>So what I'd like to do is write some code which can find my templates
>>>>and copy the styles, toolbars and modules/userforms to a new version of
>>>>the template. I think the organiser can be accessed using VBA but I'm
>>>>not sure about importing modules and forms.
>>>>
>>>>Can anyone provide a sample of using the organiser and, if it can be
>>>>done, code to import modules and forms.
>>>>
>>>>Any pointers appreciated.
>>>>
>>>>J
>>>
>>>
>>>
>>Ahh, any chance you could supply a sample Chad?
>>
>>J
>
>
>
Thanks for your help folks, Both suggestions will be used!
Cheers
J