Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    May 2006
    Portland, Oregon, USA
    Thanked 0 Times in 0 Posts

    Referring to a Style in a Macro (2007)

    First the "set up." I have a global "" that holds certain macros and styles used firm wide. This additional "" has a shortcut in the workstaiton word startup folder so it is automatically available. No problem so far. But, now I want to refer to a style in this global in a macro (that will also be in this same global The macro can't find the style, even when I set this global as an "attached template." My question. Is there a way to search for an existing style and if it does not exist in the current document to copy just this one style from the global template to the new document? OR, a way for the macro to find the style in the attached template?
    Charlotte Quiroz

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: Referring to a Style in a Macro (2007)

    Perhaps something like this:

    Const strStyle = "Blah"
    Dim stl As Style
    On Error Resume Next
    Set stl = ActiveDocument.AttachedTemplate.Styles(strStyle)
    On Error GoTo 0
    If stl Is Nothing Then
    Application.OrganizerCopy Source:="", _
    Destination:=ActiveDocument.AttachedTemplate.FullN ame, _
    Name:=strStyle, Object:=wdOrganizerObjectStyles
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts